Hi, I would like to add a continuous underbar under a paragraph or a title as in: \setupbar [color=red,offset=10pt] \starttext \underbar{Test this \high{\tfxx ®}} \stoptext ... but I'm confused about two aspects: - How can I prevent \high{} from shifting the underbar? - How can I add more offset? The color keyword works, but offset doesn't seem to have any effect even though it's listed in the reference. I was able to address the second problem (adding more offset) with something like \definebar[BarU][offset=-0.7] \startbar[BarU] ... \stopbar but I wasn't able to get rid of the shift (and the bar had a different thickness when a smaller font was used). I can find ugly workarounds with frames, but it would be ideal if I could get one of the underbar mechanisms to work "out-of-the-box". Thank you, Mojca
On 5/24/2016 1:54 AM, Mojca Miklavec wrote:
Hi,
I would like to add a continuous underbar under a paragraph or a title as in:
\setupbar [color=red,offset=10pt] \starttext \underbar{Test this \high{\tfxx ®}} \stoptext
... but I'm confused about two aspects:
- How can I prevent \high{} from shifting the underbar?
i need to think about it .. maybe an option
- How can I add more offset?
underbar is derived from the parent but has its own offset and an offset is relative to the baseline and a fraction of th eunit (normally the ex of a font) \setupbar[underbar][color=red,offset=-.5] \starttext \underbar{Test this \high{\tfxx ®}} \stoptext
The color keyword works, but offset doesn't seem to have any effect even though it's listed in the reference.
I was able to address the second problem (adding more offset) with something like \definebar[BarU][offset=-0.7] \startbar[BarU] ... \stopbar but I wasn't able to get rid of the shift (and the bar had a different thickness when a smaller font was used).
I can find ugly workarounds with frames, but it would be ideal if I could get one of the underbar mechanisms to work "out-of-the-box".
just see how underbar is defined ... if you want fixed dimensions you should used a fixed unit (not one derived from the current font) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Hans Hagen mailto:pragma@wxs.nl 24. Mai 2016 um 14:19 On 5/24/2016 1:54 AM, Mojca Miklavec wrote:
Hi,
I would like to add a continuous underbar under a paragraph or a title as in:
\setupbar [color=red,offset=10pt] \starttext \underbar{Test this \high{\tfxx ®}} \stoptext
... but I'm confused about two aspects:
- How can I prevent \high{} from shifting the underbar?
i need to think about it .. maybe an option
- How can I add more offset?
underbar is derived from the parent but has its own offset and an offset is relative to the baseline and a fraction of th eunit (normally the ex of a font)
\setupbar[underbar][color=red,offset=-.5]
\starttext
\underbar{Test this \high{\tfxx ®}}
\stoptext With \shiftup the line under the raised text stays at the same position.
\starttext \underbar{Test this \shiftup{®}} \stoptext Wolfgang
On 25 May 2016 at 17:35, Wolfgang Schuster wrote:
With \shiftup the line under the raised text stays at the same position.
\starttext \underbar{Test this \shiftup{®}} \stoptext
When has \shiftup been implemented? It doesn't work in TeX Live (or maybe I forgot to update TL to the latest version), but works with the latest version of ConTeXt. Nevertheless this doesn't entirely solve the problem. I now have a problem with the following: \catcode`č=\active \defč{\buildtextaccent\textcaron c} \underbar{Test this č} I will try to remember how to fix the font on the fly with lua (or perhaps figure out how to edit the font; it's a commercial font though, so fixing it "on the fly" would probably be better). I will also test some other piece of code that Hans sent me off-list. (I seem to remember that there must be some tens of ways to underline text. Every now and then Hans sends a new demo.) Mojca
On Thu, 26 May 2016 14:48:00 +0200
Mojca Miklavec
On 25 May 2016 at 17:35, Wolfgang Schuster wrote:
With \shiftup the line under the raised text stays at the same position.
\starttext \underbar{Test this \shiftup{®}} \stoptext
When has \shiftup been implemented?
The git history first mentions it on 2015.12.22. I didn't know that command, either. Marco
On 5/26/2016 2:48 PM, Mojca Miklavec wrote:
On 25 May 2016 at 17:35, Wolfgang Schuster wrote:
With \shiftup the line under the raised text stays at the same position.
\starttext \underbar{Test this \shiftup{®}} \stoptext
When has \shiftup been implemented?
It doesn't work in TeX Live (or maybe I forgot to update TL to the latest version), but works with the latest version of ConTeXt.
it has always been there but recently i saw that when i had updated some low level stuff (to new luatex) i had forgotten something, so i fixed that
Nevertheless this doesn't entirely solve the problem. I now have a problem with the following:
\catcode`č=\active \defč{\buildtextaccent\textcaron c}
doesn't the compose=yes feature work?
\underbar{Test this č}
I will try to remember how to fix the font on the fly with lua (or perhaps figure out how to edit the font; it's a commercial font though, so fixing it "on the fly" would probably be better).
I will also test some other piece of code that Hans sent me off-list. (I seem to remember that there must be some tens of ways to underline text. Every now and then Hans sends a new demo.)
so let's give you another piece \startluacode fonts.handlers.otf.addfeature { name = "mojca", type = "multiple", prepend = true, data = { ["č"] = { 0x30C, "c" }, } } fonts.handlers.otf.addfeature { name = "kern", type = "pair", data = { [0x30C] = { c = { { 500, 0, 0, 0 }, false } }, } } \stopluacode \definefontfeature[default][default][mojca=yes] \showframe \starttext mojča miklave\utfchar{"30C}c \stoptext (actually it uncovered a buglet but i suppose the č never is the first char so ...) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 26 May 2016 at 18:17, Hans Hagen wrote:
On 5/26/2016 2:48 PM, Mojca Miklavec wrote:
Nevertheless this doesn't entirely solve the problem. I now have a problem with the following:
\catcode`č=\active \defč{\buildtextaccent\textcaron c}
doesn't the compose=yes feature work?
I'm sorry, compose=yes works as expected (I was copy pasting some old code and forgot about the later improvements in ConTeXt: shame on me).
so let's give you another piece
\startluacode fonts.handlers.otf.addfeature { name = "mojca", type = "multiple", prepend = true, data = { ["č"] = { 0x30C, "c" }, } } fonts.handlers.otf.addfeature { name = "kern", type = "pair", data = { [0x30C] = { c = { { 500, 0, 0, 0 }, false } }, } } \stopluacode
\definefontfeature[default][default][mojca=yes]
\showframe
\starttext
mojča miklave\utfchar{"30C}c
\stoptext
(actually it uncovered a buglet but i suppose the č never is the first char so ...)
But the code above doesn't seem to work (I don't get the letter "č" printed out at all). I would prefer the approach with more fine-tuning though because "č" is always misaligned. And I seem to remember that this functionality has been in the core for a long time already, I just again forgot about it because most fonts include the full charset nowadays. Mojca
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
Marco Patzer
-
Mojca Miklavec
-
Wolfgang Schuster