On 3/19/25 12:57, frechefuchs via Discuss wrote:
Is there any way to enable custom font features when using text() in
OpenSCAD?
As of just now the answer is Yes. Builds may take a day or two to
pick it up.
You can enable/disable fontfeatures (supported by the selected font)
by adding those to the font specifier.
Example with both "Oldstyle Figures" (onum) and "Small Caps" (smcp):
font = "Linux Biolinum O:style=Regular:fontfeatures=+smcp;+onum"
Screenshot, see https://github.com/openscad/openscad/pull/5763
There is currently no way for discovering font features in OpenSCAD
itself, but you can use services like https://fontdrop.info/ to list
and interactively test features available in a specific font.
My favorite features so far are "Oldstyle Figures" and "Slashed Zero",
I did not know some fonts even provide both a Zero glyph with and one
without a slash.
ciao,
Torsten.
Am 22.03.25 um 18:19 schrieb Torsten Paul via Discuss:
On 3/19/25 12:57, frechefuchs via Discuss wrote:
Is there any way to enable custom font features when using text() in
OpenSCAD?
As of just now the answer is Yes. Builds may take a day or two to
pick it up.
Sorry for coming back only late! Been busy.
You can enable/disable fontfeatures (supported by the selected font)
by adding those to the font specifier.
Example with both "Oldstyle Figures" (onum) and "Small Caps" (smcp):
font = "Linux Biolinum O:style=Regular:fontfeatures=+smcp;+onum"
Screenshot, see https://github.com/openscad/openscad/pull/5763
This looks great! Too late for my application, unfortunately. But very
much appreciated, nevertheless! When writing my mail, I already knew
anything else than some easy to apply trick would be too late for me.
There's so much to do and only so few time.
There is currently no way for discovering font features in OpenSCAD
itself, but you can use services like https://fontdrop.info/ to list
and interactively test features available in a specific font.
No problem, font features supported by a font can be retrieved with
otfinfo from the lcdf-typetools package (Linux Biolinum font happens to
cover quite a number of them):
$ otfinfo -f /usr/share/fonts/opentype/linux-libertine/LinBiolinum_R.otf
aalt Access All Alternates
c2sc Small Capitals From Capitals
case Case-Sensitive Forms
ccmp Glyph Composition/Decomposition
cpsp Capital Spacing
dlig Discretionary Ligatures
fina Terminal Forms
frac Fractions
hlig Historical Ligatures
kern Kerning
liga Standard Ligatures
lnum Lining Figures
mark Mark Positioning
nalt Alternate Annotation Forms
onum Oldstyle Figures
pnum Proportional Figures
salt Stylistic Alternates
sinf Scientific Inferiors
smcp Small Capitals
ss01 Stylistic Set 1
ss02 Stylistic Set 2
ss03 Stylistic Set 3
ss04 Stylistic Set 4
sups Superscript
tnum Tabular Figures
zero Slashed Zero
The Gnome font viewer showing a more prosaic version of that list after
clicking on a font (file), the "Info" button and then looking at "layout
functions" (translated from German UI).
My favorite features so far are "Oldstyle Figures" and "Slashed Zero",
I did not know some fonts even provide both a Zero glyph with and one
without a slash.
My use-case was modelling a gravestone before negotiating with a
stonemason. (I've opted for the lining figures now, which fits well
with the geometric design.) In this application tabular (fixed-width)
digits (tnum) are needed for the vertical alignment (the default in most
fonts). In other cases, using proportional digits (pnum) might come in
handy as well. Linux Biolinum provides all four combinations of
lnum/onum and tnum/pnum whereas most fonts provide just one set of
lining, tabular digits. Stylistic alternates (salt), historical
ligatures (hlig) and terminal forms (fina) can also be interesting to
watch out for. Those are meant to be applied in short, decorative texts
more so than in running text in books. But typography can be a slippery
slope, and you can easily turn a design into Kitsch ...
Thanks again!
frechefuchs
On 3/23/25 11:02, frechefuchs via Discuss wrote:
Am 22.03.25 um 18:19 schrieb Torsten Paul via Discuss:
On 3/19/25 12:57, frechefuchs via Discuss wrote:
Is there any way to enable custom font features when using text() in
OpenSCAD?
As of just now the answer is Yes. Builds may take a day or two to
pick it up.
Sorry for coming back only late! Been busy
This is absolutely beautiful work, thank you. But the printed docs I
have are grossly out of date, so my question is: How long till it is
fully described in the OpenSCAD manual as part of the weekly build? I
need to print an updated version as I work better from the printed pages.
Tnx.
You can enable/disable fontfeatures (supported by the selected font)
by adding those to the font specifier.
Example with both "Oldstyle Figures" (onum) and "Small Caps" (smcp):
font = "Linux Biolinum O:style=Regular:fontfeatures=+smcp;+onum"
Screenshot, see https://github.com/openscad/openscad/pull/5763
This looks great! Too late for my application, unfortunately. But very
much appreciated, nevertheless! When writing my mail, I already knew
anything else than some easy to apply trick would be too late for me.
There's so much to do and only so few time.
There is currently no way for discovering font features in OpenSCAD
itself, but you can use services like https://fontdrop.info/ to list
and interactively test features available in a specific font.
No problem, font features supported by a font can be retrieved with
otfinfo from the lcdf-typetools package (Linux Biolinum font happens to
cover quite a number of them):
$ otfinfo -f /usr/share/fonts/opentype/linux-libertine/LinBiolinum_R.otf
aalt Access All Alternates
c2sc Small Capitals From Capitals
case Case-Sensitive Forms
ccmp Glyph Composition/Decomposition
cpsp Capital Spacing
dlig Discretionary Ligatures
fina Terminal Forms
frac Fractions
hlig Historical Ligatures
kern Kerning
liga Standard Ligatures
lnum Lining Figures
mark Mark Positioning
nalt Alternate Annotation Forms
onum Oldstyle Figures
pnum Proportional Figures
salt Stylistic Alternates
sinf Scientific Inferiors
smcp Small Capitals
ss01 Stylistic Set 1
ss02 Stylistic Set 2
ss03 Stylistic Set 3
ss04 Stylistic Set 4
sups Superscript
tnum Tabular Figures
zero Slashed Zero
The Gnome font viewer showing a more prosaic version of that list after
clicking on a font (file), the "Info" button and then looking at "layout
functions" (translated from German UI).
My favorite features so far are "Oldstyle Figures" and "Slashed Zero",
I did not know some fonts even provide both a Zero glyph with and one
without a slash.
My use-case was modelling a gravestone before negotiating with a
stonemason. (I've opted for the lining figures now, which fits well
with the geometric design.) In this application tabular (fixed-width)
digits (tnum) are needed for the vertical alignment (the default in most
fonts). In other cases, using proportional digits (pnum) might come in
handy as well. Linux Biolinum provides all four combinations of
lnum/onum and tnum/pnum whereas most fonts provide just one set of
lining, tabular digits. Stylistic alternates (salt), historical
ligatures (hlig) and terminal forms (fina) can also be interesting to
watch out for. Those are meant to be applied in short, decorative texts
more so than in running text in books. But typography can be a slippery
slope, and you can easily turn a design into Kitsch ...
Thanks again!
frechefuchs
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
How long till it is fully described in the OpenSCAD manual as part of the weekly build?
That’s an interesting question. The “fontconfig” library does font selection mostly without OpenSCAD’s involvement. We hand it a font specification, and it hands us back some kind of font identifier (I don’t remember exactly what) that we hand to other components (Harfbuzz for layout and glyph selection, FreeType to actually generate outlines). Mostly that process is a black box for us. This particular parameter we have to extract from the data returned by fontconfig and pass on to the others, so we know that the parameter exists… but we don’t know what its options are or what they do. (I’m actually kind of surprised that we have to do even that much.) Fontconfig has numerous parameters that you can supply, and many or most of them are processed without our knowledge. It isn’t clear how much we should describe about how this separate library does its job or exactly what it does. Perhaps we should just direct people to fontconfig’s documentation. (Which is sadly weak, given how many applications use it.) We certainly don’t generally want to be in the business of documenting their library’s behavior.
On 3/24/25 03:06, Jordan Brown wrote:
How long till it is fully described in the OpenSCAD manual as part of the weekly build?
That’s an interesting question. The “fontconfig” library does font selection mostly without OpenSCAD’s involvement. We hand it a font specification, and it hands us back some kind of font identifier (I don’t remember exactly what) that we hand to other components (Harfbuzz for layout and glyph selection, FreeType to actually generate outlines). Mostly that process is a black box for us. This particular parameter we have to extract from the data returned by fontconfig and pass on to the others, so we know that the parameter exists… but we don’t know what its options are or what they do. (I’m actually kind of surprised that we have to do even that much.) Fontconfig has numerous parameters that you can supply, and many or most of them are processed without our knowledge. It isn’t clear how much we should describe about how this separate library does its job or exactly what it does. Perhaps we should just direct people to fontconfig’s documentation. (Which is sadly weak, given how many applications use it.) We certainly don’t generally want to be in the business of documenting their library’s behavior.
I had no idea it was that complex, Jordan. Thank you for a thoughtful
answer.
Best then is probably just a link to their docs in ours, with the
possibility of questioning their site for better docs for those of us
who might want to explore further. FWIW, what I've done with what we
have w/o calling an external library is generally satisfactory. .png
attached. That text is engraved about .7mm deep on all 4 sides of those
half nuts. And is very legible when printed on my rebuilt Ender5+ at
150mm/sec feed rates. The frame & bed is about the only original parts.
I can print in PC (which has a reputation of being bitchy but I've found
the temps fix that) like most printers do PLA.
Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.