fontspec
fontspec copied to clipboard
add optical bounds to fontspec
@wspr, I wonder whether opbd
could be implemented in fontspec.
the OpenType feature “optical bounds” has been implemented recently in ConTeXt.
Here you have a sample that shows the feature:
\definefontfeature[default][default][protrusion=yes,opbd=yes]
\setupbodyfont[ebgaramond, 150pt]
\setupalign[hanging]
\showframe
\starttext
\input tufte
\stoptext
The previous sample requires a recent beta from the ConTeXt Suite.
Could optical bounds be implemented in fontspec with LuaTeX?
As far as I know, opbd
invokes both lfbd
and rtbd
. And it also requires protrusion to be enabled.
I mostly limit fontspec’s interface to loading of font features. So yes, I can definitely make opbd
etc available with a “friendly” name, but I would rely on others to setup the actual protrusion settings. (But happy also to add hooks to fontspec to facilitate this.)
@wspr, I see. Further asking in the LuaLaTeX mailing list.
I tried out the example with a current context minimals but I can't see what the option is supposed to do - the output with and without the option looks the same to me.
@u-fischer, many thanks for your reply.
I have another sample with exaggerated values:
\showframe
\definefontfeature[default][default][protrusion=quality, opbd=yes]
\definefontfamily[mainface][rm][TestOPBD]
\setupbodyfont[mainface, 60pt]
\setupalign[hanging]
\starttext
Ἠ\\Ἠ\\Ἦ\\ἯἯ
\stoptext
With opbd
:
Without opbd
:
And where can one get the font you used?
http://www.ousia.tk/TestOPBD-Regular.otf is the address.
I only edited a pair of glyphs (from capital eta) from GFS Baskerville with fontforge
.
Of course, the values are exaggerated and the font isn’t intended for distribution. Not even all capital eta glyphs with diacritics have a lfbd
value set.
BTW, other Greek capital glyphs with diacritics have “incorporated” the left bounds to the left side bearing (which is wrong). This means that only capital eta is free from this error.
@u-fischer, any news on optical margins for LuaLaTeX?
Pablo, would you be able to test your example font with plain XeTeX and LuaTeX+luaotfload? E.g. syntax like
\input luaotfload.sty\relax
\font\1=“EBGaramond-Regular.otf:+opbd” at 12pt\relax
\1 this is a test
If it works there then it’s easy for me to add the syntax to fontspec.
Will, sorry because I was so stupid not to recognize what I already knew.
The following works in LuaTeX and (partially) in XeTeX from TL 2016:
\input ifluatex.sty
\ifluatex\input luaotfload.sty\fi
\font\1="TestOPBD-Regular:+lfbd,+rtbd"
\1 Ἠ
Ἠ\hfill Ἠ
Ἦ\hfill ὩὩ
ἯἯ\hfill ὩὩ
\bye
Output from ConTeXt (sorry, but I don’t know how to get a reasonable page size in plain TeX):
What I knew: opbd
is handled by the application, not by the font (which provides both lfbd
and rtbd
, but no opbd
).
To test both sides of optical margin, I added rtbd
values to the font provided for testing at http://www.ousia.tk/TestOPBD-Regular.otf.
The partial failure in XeTeX is that rtbd
doesn’t seem to work.
I’m not subscribed to the XeTeX mailing list. If you were, would you be so kind to report this issue there?
I guess an option name such as OpticalBounds
or OpticalMargins
might make sense here.
@wspr, since you reported the issue more than two weeks ago and it is clear that XeTeX has to fix +rtbd
, how about implementing optical bounds in fontspec right now?
I mean, if XeTeX is fixed, it will work fine with no further changes required in fontspec.
I’m asking for this, because some users would like to use it with LuaTeX.
If you allow me a final suggestion, I think we should have three options:
-
OpticalBounds:
+lfbd,+rtbd
-
LeftBounds:
+lfbd
-
RightBounds:
+rtbd
I mean, it should be possible to enable left, right or both margins.
For example, optical bounds in polytonic Greek should be applied (according to some Greek typographical traditions) only in the left margin.
No problem with adding them straight away, I’m just very pressed for time right now. I only just managed to push out a critical bug fix the other day and haven’t been able to spend any time on this, sorry.
My preference would be to have the naming more along the lines of
OpticalBounds = Left
OpticalBounds = Right
OpticalBounds = Both
Or something like that. Thoughts?
@wspr, sorry, I thought you were waiting for XeTeX to fix rtbt
before implementing any code.
Your preference looks fine to me. It is better than mine.