Hi Joris,
yes, I agree with you.
I do not see a general solution. In most of the cases however I'm willing to sacrifice generality to have a higher quality text-mode underline and leave the current underline as a backup.
1) Would it be possible to implement an "underlined font variant" maybe using a virtual font and combining glyphs with the "_" glyph, which I noticed it is at the right distance (and maybe designed for this purpose in the old ages...)? We need a way to mask certain parts of the underline, so that not all the underline is inking the device. This would solve the problem with backgrounds and avoid my hacky solution.
2) subscripts will pose a problem, indeed, but maybe one can safely assume that when a subscript is present the underline will be covered, so there is nothing to do there.
3) Ideally the approach I was using would also work for more general markup, it could work if we (and the PDF) have a "mask" operation which works at the vectorial level. I need to check what are the operations you implemented for virtual fonts.
Max
Hi Max,
Yes, I have also been thinking about this problem, which is quite tricky. There are various difficulties:
- If we want things to print nicely, then we need a vectorial solution. So if we do pixel magic, it must still be vectorial pixel magic.
- It is problematic if to fatten our fonts using the background color, since the background might be a pattern or we might painting on top of something else.
- What should underlining do on more complex markup (a fraction, a text with a subscript or superscript, etc.)?Or do we simply sacrifice some of the things that we might want?Best wishes, --JorisOn Tue, Dec 22, 2020 at 10:08:21PM +0100, Massimiliano Gubinelli wrote:Dear all,
I'm not very fond of the \underline style in TeXmacs. Even some browsers (e.g. Safari) do better, in particular put the line nearer to the glyphs and take into account descenders (e.g. "g" or "p").
TeX has similar problems and there are solutions around, e.g. here:
https://alexwlchan.net/2017/10/latex-underlines/
Also some CSS trickery can do something for most of the browsers:
https://css-tricks.com/styling-underlines-web/
I've experimented with similar solutions for TeXmacs. Using \superpose, \datom and \thicken one can indeed create the wanted underline and it works also on the generated PDF file, however \datom does not interact properly with \superpose and one cannot have multiline underlines...
Is there a way to make this work?
I attach a file with my experiments and tentative implementation. (the colors are used to debug)
Best Max
_______________________________________________ Texmacs-dev mailing list Texmacs-dev@gnu.org https://lists.gnu.org/mailman/listinfo/texmacs-dev
_______________________________________________Texmacs-dev mailing listTexmacs-dev@gnu.orghttps://lists.gnu.org/mailman/listinfo/texmacs-dev
|