* [NTG-context] Scaling characters without font switching in CLD @ 2023-08-12 14:03 Hamid,Idris 2023-08-12 15:34 ` [NTG-context] " Hans Hagen 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 14:03 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 6307 bytes --] Dear gang, I. In Context, as is well known, scaling a character is not independent of switching the font: ======= \startTEXpage[offset=1em] \definefont[Times][times @ 14pt] \Times Test \tfx Test \setupinterlinespace \Times Test \switchtobodyfont[x]Test \Times Test \high{Test} \stopTEXpage ======= \tfx causes a switch to computer modern. Of course, with the right typescripts and \setupbodyfont, one can maintain stylistic consistency when switching fonts. But what if we want to scale independently of font switching? II. One approach might be to use symbols: \startTEXpage \definesymbol[Tee][\getglyph{times}{T}] \symbol[Tee]est \tfx \symbol[Tee]est \tfa \symbol[Tee]est \stopTEXpage In this example, \tfa does scale the symbol Tee. But \tfx does not scale the symbol! Why does \tfa (or higher such as \tfb etc.) work, but not \tfx (or lower)? III. The best approach would be to do it in CLD (Context Lua Code). That is mostly beyond my skill to write from scratch without a template, but there are some experiments in the system file font-imp-effects.lua. There we will find, e.g., local specification = { name = "extend", description = "scale glyphs horizontally", initializers = { base = initializeextend, node = initializeextend, } } local specification = { name = "squeeze", description = "scale glyphs vertically", initializers = { base = initializesqueeze, node = initializesqueeze, } } This seems hopeful: \definecolor [transparentgreen] [g=1,t=.7,a=1] \definecolor [transparentred] [r=1,t=.7,a=1] \definecolor [transparentyellow] [y=1,t=.7,a=1] \startTEXpage[offset=1em] \definefontfeature[scale][default][extend=yes,squeeze=yes] \hbox{\rlap{\definedfont[times @ 14pt]\transparentgreen Test}% \definedfont[times*scale @ 14pt]\transparentred Test} \stopTEXpage But there is no scaling of the character, extend=yes shifts the glyphs to the left, and squeeze=yes appears to do nothing at all. Here is a file collecting these experiments: https://www.dropbox.com/scl/fi/dggj3ypgjjeia1bo4eelb/test-scaling.tex?rlkey=hcky6ol594mw8u0j2j1z22heh&dl=0 https://www.dropbox.com/scl/fi/o2u1tsq515ycyoeup43qg/test-scaling.pdf?rlkey=h7gof1vyq3r0bh72qynh71apc&dl=0 IV. Objective: I need to be able to define a couple of characters in CLD -- glottal stops --, and add commands to scale and/or rotate a character without triggering a font switch. Again, writing this from scratch is beyond my current skill set - although I've recently started to study CLD. Something like this -- some of the semantics is almost certainly wrong and/or clumsy -) ============== -- ʿ ringhalfleft local function ringhalfleft (characters,target,base,accent) -- if not characters[target] then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { -- "ʿ" height = data1.height, depth = (data1.depth or 0) + 0.5*(data2.height or 0), width = data1.width, unicode = target, commands = { { "slot", 0, 0 }, { "left", -0.5*(data2.width or 0) + 0.5*(data2.width or 0)}, -- { "down", 0.2*(data2.height or 0) + (data2.height or 0) }, { "up", 0.0*(data2.height or 0) + (data2.height or 0) }, { "slot", 0, 0x063, }, { "squeeze", 0.75*(data2.height or 0) }, { "extend", 0.75*(data2.width or 0) }, }, } end -- end end -- ʾ ringhalfright local function ringhalfright (characters,target,base,accent) -- if not characters[target] then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { -- "ʾ" height = data1.height, depth = (data1.depth or 0) + 0.5*(data2.height or 0), width = data1.width, unicode = target, commands = { { "slot", 0, 0 }, { "left", -0.35*(data2.width or 0) + 0.5*(data2.width or 0)}, { "down", 0.0*(data2.height or 0) + (data2.height or 0) }, -- { "up", 0.0*(data2.height or 0) + (data2.height or 0) }, { "slot", 0, 0x063, }, { "squeeze", 0.75*(data2.height or 0) }, { "extend", 0.75*(data2.width or 0) }, }, } end -- end end local function initialize(tfmdata,value) if value then -- Hdotbelow(tfmdata.characters,0x02BF,0x063,0) -- ringhalfleft (tfmdata.characters,0x02BF,0x063,0x063) ringhalfright(tfmdata.characters,0x02BE,0x063,0x063) -- (i.e., tfmdata.characters,target,base,accent) -- hdotbelow(tfmdata.characters,0x1E25,0x068,0x2D9) end end local function scale (ringhalfleft,ringhalfright) for v in next, ringhalfleft do v.height = 0.75 * (v.height or 0) v.width = 0.75 * (v.width or 0) v.depth = 0.75 * (v.depth or 0) end for v in next, ringhalfright do v.height = 0.75 * (v.height or 0) v.width = 0.75 * (v.width or 0) v.depth = 0.75 * (v.depth or 0) end end local specification = { name = "glottalstops", description = "glottalstops", manipulators = { base = initialize, node = initialize, } } ============== Rotation for one of the characters is also needed. Here is an experimental test file: https://www.dropbox.com/scl/fi/wi81e23wg17k8jasqpeon/transliteration-glottal-lua.tex?rlkey=gfwgjduhta1iemouwvjp1n6v3&dl=0 https://www.dropbox.com/scl/fi/rca5v6uusyj6mogyklfpd/transliteration-glottal-lua.pdf?rlkey=ou1lbfdkwec4tpbgkkk3kh9b9&dl=0 Thank you in advance for your guidance. Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 [-- Attachment #1.2: Type: text/html, Size: 10486 bytes --] [-- Attachment #2: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 14:03 [NTG-context] Scaling characters without font switching in CLD Hamid,Idris @ 2023-08-12 15:34 ` Hans Hagen 2023-08-12 18:05 ` Hamid,Idris 0 siblings, 1 reply; 10+ messages in thread From: Hans Hagen @ 2023-08-12 15:34 UTC (permalink / raw) To: ntg-context On 8/12/2023 4:03 PM, Hamid,Idris wrote: > \tfx causes a switch to computer modern. Indeed. Something I need to discuss with Wolfgang as double checking is needed before I patch. > But what if we want to scale independently of font switching? There is no need to go lua here (esp when you have not done vf magick before and i'm not going to debug code that i have little clue what it's about to do). - we cheat here and yuse glyph scaled (I have to provide a relative to current x/y scaling, don't use \glyphscale as that one is used by context itself - we use the style variant so that it adapts - you have to replace "Serif" with "YourFont" and map that one onto a file (YourFont YourFontBold etc) - more about these box manipulations in the low level manual \startsetups glyph:iTee \dontleavehmode\hpack\bgroup \setbox\scratchbox \ruledhbox \bgroup \glyphxscale 400 \glyphyscale 400 \getglyphstyled{Serif}{T}% choose a font here \egroup \scratchheight 2.75\ht\scratchbox \boxyoffset \scratchbox\scratchheight \boxorientation\scratchbox\plustwo \ht \scratchbox\scratchheight \box\scratchbox \egroup \stopsetups \definesymbol [iTee] [\directsetup{glyph:iTee}] \startTEXpage [offset=1ts,width=2cm] \ruledhbox {\tfx T \symbol{iTee}} \par \ruledhbox {T \symbol{iTee}} \par \ruledhbox {\tfa T \symbol{iTee}} \par \ruledhbox {\bfd T \symbol{iTee}} \stopTEXpage Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 15:34 ` [NTG-context] " Hans Hagen @ 2023-08-12 18:05 ` Hamid,Idris 2023-08-12 20:10 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 18:05 UTC (permalink / raw) To: ntg-context, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 3577 bytes --] On Aug 12, 2023, 9:35 AM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: ** Caution: EXTERNAL Sender ** On 8/12/2023 4:03 PM, Hamid,Idris wrote: \tfx causes a switch to computer modern. Indeed. Something I need to discuss with Wolfgang as double checking is needed before I patch. Ah.. ok. But what if we want to scale independently of font switching? There is no need to go lua here (esp when you have not done vf magick before and i'm not going to debug code that i have little clue what it's about to do). Many thanks. Part of the context is that I have some updatable mission-critical documents that depended on \defineactivecharacter, which is apparently deprecated in LMTX. See earlier thread with that subject line. [BTW: Just this morning someone from the Persian Gulf asked for an updated version of a document whose compilation depended on \defineactivecharacter, so I need to get this working in the new regime -)] Now the templates that you provided - many, many thanks! - have what is needed to care of everything except for two characters: 02BE and 02BF. For one of those two remaining characters we also need scaling, for the other we also need scaling + rotation. It is not clear to me whether the scaling/rotation commands should fall under the character function, e.g., ======= -- ʿ ringhalfleft local function ringhalfleft (characters,target,base,accent) ======= the initialize function ======= local function initialize(tfmdata,value) ======= or whether we just make a new function altogether ======= local function scale (ringhalfleft) -- shooting in the dark here ======= So the reason I said CLD is best is because we already defined all of the needed characters that way -- using your template -- except for these two, for which we need to add scaling and or rotation. The attached (linked in the previous email but attached here) gives us rotation but no scaling. - we cheat here and yuse glyph scaled (I have to provide a relative to current x/y scaling, don't use \glyphscale as that one is used by context itself - we use the style variant so that it adapts - you have to replace "Serif" with "YourFont" and map that one onto a file (YourFont YourFontBold etc) - more about these box manipulations in the low level manual Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to focus on in this case -) \startsetups glyph:iTee \dontleavehmode\hpack\bgroup \setbox\scratchbox \ruledhbox \bgroup \glyphxscale 400 \glyphyscale 400 \getglyphstyled{Serif}{T}% choose a font here \egroup \scratchheight 2.75\ht\scratchbox \boxyoffset \scratchbox\scratchheight \boxorientation\scratchbox\plustwo \ht \scratchbox\scratchheight \box\scratchbox \egroup \stopsetups \definesymbol [iTee] [\directsetup{glyph:iTee}] \startTEXpage [offset=1ts,width=2cm] \ruledhbox {\tfx T \symbol{iTee}} \par \ruledhbox {T \symbol{iTee}} \par \ruledhbox {\tfa T \symbol{iTee}} \par \ruledhbox {\bfd T \symbol{iTee}} \stopTEXpage Great, will study this. The challenge (for me) will be integrating this approach into the lua definitions of the two needed characters. With \defineactivecharacter deprecated, there seems to be no way other than CLD to make and register the needed macro for \definefontfeature -- and we want to move forward with the new regime and not look back. With many thanks and much gratitude, Hans. Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 [-- Attachment #1.2: Type: text/html, Size: 5267 bytes --] [-- Attachment #2: transliteration--glottal-lua.pdf --] [-- Type: application/octet-stream, Size: 6507 bytes --] [-- Attachment #3: transliteration--glottal-lua.tex --] [-- Type: application/octet-stream, Size: 4333 bytes --] % % \defineactivecharacter ʿ {\high{c}} % % \defineactivecharacter ʾ {\kern.07 em \high{\rotate[rotation=180,location=high]{c}}} % % or better % % \definecharacter ʿ {\high{c}} % % \definecharacter ʾ {\kern.07 em \high{\rotate[rotation=180,location=high]{c}}} \startluacode -- ʿ ringhalfleft local function ringhalfleft (characters,target,base,accent) -- if not characters[target] then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { -- "ʿ" height = data1.height, depth = (data1.depth or 0) + 0.5*(data2.height or 0), width = data1.width, unicode = target, commands = { { "slot", 0, 0 }, { "left", -0.5*(data2.width or 0) + 0.5*(data2.width or 0)}, -- { "down", 0.2*(data2.height or 0) + (data2.height or 0) }, { "up", 0.0*(data2.height or 0) + (data2.height or 0) }, { "slot", 0, 0x063, }, { "squeeze", 0.75*(data2.height or 0) }, { "extend", 0.75*(data2.width or 0) }, }, } end -- end end -- ʾ ringhalfright local function ringhalfright (characters,target,base,accent) -- if not characters[target] then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { -- "ʾ" height = data1.height, depth = (data1.depth or 0) + 0.5*(data2.height or 0), width = data1.width, unicode = target, commands = { { "slot", 0, 0 }, { "left", -0.35*(data2.width or 0) + 0.5*(data2.width or 0)}, { "down", 0.0*(data2.height or 0) + (data2.height or 0) }, -- { "up", 0.0*(data2.height or 0) + (data2.height or 0) }, { "slot", 0, 0x063, }, { "squeeze", 0.75*(data2.height or 0) }, { "extend", 0.75*(data2.width or 0) }, }, } end -- end end local function initialize(tfmdata,value) if value then -- Hdotbelow(tfmdata.characters,0x02BF,0x063,0) -- ringhalfleft (tfmdata.characters,0x02BF,0x063,0x063) ringhalfright(tfmdata.characters,0x02BE,0x063,0x063) -- (i.e., tfmdata.characters,target,base,accent) -- hdotbelow(tfmdata.characters,0x1E25,0x068,0x2D9) end end local function scale (ringhalfleft,ringhalfright) for v in next, ringhalfleft do v.height = 0.75 * (v.height or 0) v.width = 0.75 * (v.width or 0) v.depth = 0.75 * (v.depth or 0) end for v in next, ringhalfright do v.height = 0.75 * (v.height or 0) v.width = 0.75 * (v.width or 0) v.depth = 0.75 * (v.depth or 0) end end local specification = { name = "glottalstops", description = "glottalstops", manipulators = { base = initialize, node = initialize, } } fonts.handlers.otf.features.register(specification) \stopluacode \definefontfeature[glottals][default][glottalstops=yes] % \definedfont[Serif*default @ 11pt] \showglyphs \noheaderandfooterlines \definecolor [transparentgreen] [g=1,t=.7,a=1] \definecolor [transparentred] [r=1,t=.7,a=1] \definecolor [transparentyellow] [y=1,t=.7,a=1] \switchtobodyfont[schola,12pt] \setupwhitespace[big] \setuplayout[lines=40] \starttext \startTEXpage[offset=10em,width=10in] \definedfont[MinionPro-Regular.otf*glottals @ 112pt] 1. cʿc \ AʿA \blank[7*big] 2. cʾc \ AʾA \blank[7*big] 3. c{\definedfont[MinionPro-Regular.otf*glottals @ 84pt]ʾ}c \ A{\definedfont[MinionPro-Regular.otf*glottals @ 84pt]ʾ}A \blank[7*big] 4. c{\definedfont[MinionPro-Regular.otf*glottals @ 84pt]\rotate[rotation=180,location=high]{ʾ}}c \ A{\definedfont[MinionPro-Regular.otf*glottals @ 84pt]\rotate[rotation=180,location=high]{ʾ}}A \stopTEXpage \stoptext [-- Attachment #4: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 18:05 ` Hamid,Idris @ 2023-08-12 20:10 ` Hans Hagen via ntg-context 2023-08-12 21:33 ` Hamid,Idris 0 siblings, 1 reply; 10+ messages in thread From: Hans Hagen via ntg-context @ 2023-08-12 20:10 UTC (permalink / raw) To: ntg-context; +Cc: Hans Hagen On 8/12/2023 8:05 PM, Hamid,Idris wrote: > On Aug 12, 2023, 9:35 AM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: > ** Caution: EXTERNAL Sender ** > > On 8/12/2023 4:03 PM, Hamid,Idris wrote: > > \tfx causes a switch to computer modern. > > Indeed. Something I need to discuss with Wolfgang as double checking is needed before I patch. > > Ah.. ok. impossible to reply as impossible to see what is your and mine text here Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 20:10 ` Hans Hagen via ntg-context @ 2023-08-12 21:33 ` Hamid,Idris 2023-08-12 21:48 ` Hans Hagen 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 21:33 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 4136 bytes --] On Aug 12, 2023, 2:11 PM -0600, Hans Hagen via ntg-context <ntg-context@ntg.nl>, wrote: > impossible to reply as impossible to see what is your and mine text here Hm.. This new/modern email client (forced to update by the university) supports inline replies, and I can see the levels, but the distinctions between levels of reply appears to get lost when filtered by the ntg-context list (looking at the archives). So here it is again, with levels of reply made explicit: On Aug 12, 2023, 9:35 AM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: ** Caution: EXTERNAL Sender ** On 8/12/2023 4:03 PM, Hamid,Idris wrote: >> \tfx causes a switch to computer modern. > Indeed. Something I need to discuss with Wolfgang as double checking is needed before I patch. Ah.. ok. >> But what if we want to scale independently of font switching? > There is no need to go lua here (esp when you have not done vf magick > before and i'm not going to debug code that i have little clue what it's > about to do). Many thanks. Part of the context is that I have some updatable mission-critical documents that depended on \defineactivecharacter, which is apparently deprecated in LMTX. See earlier thread with that subject line. [BTW: Just this morning someone from the Persian Gulf asked for an updated version of a document whose compilation depended on \defineactivecharacter, so I need to get this working in the new regime -)] Now the templates that you provided - many, many thanks! - have what is needed to care of everything except for two characters: 02BE and 02BF. For one of those two remaining characters we also need scaling, for the other we also need scaling + rotation. It is not clear to me whether the scaling/rotation commands should fall under the character function, e.g., ======= -- ʿ ringhalfleft local function ringhalfleft (characters,target,base,accent) ======= the initialize function ======= local function initialize(tfmdata,value) ======= or whether we just make a new function altogether ======= local function scale (ringhalfleft) -- shooting in the dark here ======= So the reason I said CLD is best is because we already defined all of the needed characters that way -- using your template -- except for these two, for which we need to add scaling and or rotation. > The attached (linked in the previous email but attached here) gives us rotation but no scaling. > - we cheat here and yuse glyph scaled (I have to provide a relative to > current x/y scaling, don't use \glyphscale as that one is used by > context itself > - we use the style variant so that it adapts > - you have to replace "Serif" with "YourFont" and map that one onto a > file (YourFont YourFontBold etc) > - more about these box manipulations in the low level manual Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to focus on in this case -) > \startsetups glyph:iTee > \dontleavehmode\hpack\bgroup > \setbox\scratchbox \ruledhbox \bgroup > \glyphxscale 400 > \glyphyscale 400 > \getglyphstyled{Serif}{T}> choose a font here > \egroup > \scratchheight 2.75\ht\scratchbox > \boxyoffset \scratchbox\scratchheight > \boxorientation\scratchbox\plustwo > \ht \scratchbox\scratchheight > \box\scratchbox > \egroup > \stopsetups > \definesymbol > [iTee] > [\directsetup{glyph:iTee}] > \startTEXpage [offset=1ts,width=2cm] > \ruledhbox {\tfx T \symbol{iTee}} \par > \ruledhbox {T \symbol{iTee}} \par > \ruledhbox {\tfa T \symbol{iTee}} \par > \ruledhbox {\bfd T \symbol{iTee}} > \stopTEXpage Great, will study this. The challenge (for me) will be integrating this approach into the lua definitions of the two needed characters. With \defineactivecharacter deprecated, there seems to be no way other than CLD to make and register the needed macro for \definefontfeature -- and we want to move forward with the new regime and not look back. With many thanks and much gratitude, Hans. Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 [-- Attachment #1.2: Type: text/html, Size: 5192 bytes --] [-- Attachment #2: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 21:33 ` Hamid,Idris @ 2023-08-12 21:48 ` Hans Hagen 2023-08-12 22:11 ` Hamid,Idris 0 siblings, 1 reply; 10+ messages in thread From: Hans Hagen @ 2023-08-12 21:48 UTC (permalink / raw) To: ntg-context On 8/12/2023 11:33 PM, Hamid,Idris wrote: > On Aug 12, 2023, 2:11 PM -0600, Hans Hagen via ntg-context <ntg-context@ntg.nl>, wrote: >> impossible to reply as impossible to see what is your and mine text here > > Hm.. This new/modern email client (forced to update by the university) supports inline replies, and I can see the levels, but the distinctions between levels of reply appears to get lost when filtered by the ntg-context list (looking at the archives). So here it is again, with levels of reply made explicit: > > On Aug 12, 2023, 9:35 AM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: > ** Caution: EXTERNAL Sender ** > > On 8/12/2023 4:03 PM, Hamid,Idris wrote: > >>> \tfx causes a switch to computer modern. > >> Indeed. Something I need to discuss with Wolfgang as double checking is needed before I patch. > > Ah.. ok. > >>> But what if we want to scale independently of font switching? > >> There is no need to go lua here (esp when you have not done vf magick >> before and i'm not going to debug code that i have little clue what it's >> about to do). > > Many thanks. Part of the context is that I have some updatable mission-critical documents that depended on \defineactivecharacter, which is apparently deprecated in LMTX. See earlier thread with that subject line. i adapted some recently but anyway active chars are a bad idea > [BTW: Just this morning someone from the Persian Gulf asked for an updated version of a document whose compilation depended on \defineactivecharacter, so I need to get this working in the new regime -)] > > Now the templates that you provided - many, many thanks! - have what is needed to care of everything except for two characters: 02BE and 02BF. you'll figure it out, right? > For one of those two remaining characters we also need scaling, for the other we also need scaling + rotation. It is not clear to me whether the scaling/rotation commands should fall under the character function, e.g., the demo shows both: x/.y scaling and 90/180/270 rotation > ======= > -- ʿ ringhalfleft > local function ringhalfleft (characters,target,base,accent) > ======= > > the initialize function > > ======= > local function initialize(tfmdata,value) > ======= > > or whether we just make a new function altogether > > ======= > local function scale (ringhalfleft) -- shooting in the dark here > ======= > > So the reason I said CLD is best is because we already defined all of the needed characters that way -- using your template -- except for these two, for which we need to add scaling and or rotation. > >> The attached (linked in the previous email but attached here) gives us rotation but no scaling. >> - we cheat here and yuse glyph scaled (I have to provide a relative to >> current x/y scaling, don't use \glyphscale as that one is used by >> context itself >> - we use the style variant so that it adapts >> - you have to replace "Serif" with "YourFont" and map that one onto a >> file (YourFont YourFontBold etc) >> - more about these box manipulations in the low level manual > > Ok. Just discovered the 11 low-level manuals yesterday, not sure which one to focus on in this case -) > >> \startsetups glyph:iTee >> \dontleavehmode\hpack\bgroup >> \setbox\scratchbox \ruledhbox \bgroup >> \glyphxscale 400 >> \glyphyscale 400 >> \getglyphstyled{Serif}{T}> choose a font here >> \egroup >> \scratchheight 2.75\ht\scratchbox >> \boxyoffset \scratchbox\scratchheight >> \boxorientation\scratchbox\plustwo >> \ht \scratchbox\scratchheight >> \box\scratchbox >> \egroup >> \stopsetups > >> \definesymbol >> [iTee] >> [\directsetup{glyph:iTee}] > >> \startTEXpage [offset=1ts,width=2cm] >> \ruledhbox {\tfx T \symbol{iTee}} \par >> \ruledhbox {T \symbol{iTee}} \par >> \ruledhbox {\tfa T \symbol{iTee}} \par >> \ruledhbox {\bfd T \symbol{iTee}} >> \stopTEXpage > > Great, will study this. The challenge (for me) will be integrating this approach into the lua definitions of the two needed characters. With \defineactivecharacter deprecated, there seems to be no way other than CLD to make and register the needed macro for \definefontfeature -- and we want to move forward with the new regime and not look back. well, you wented symbols so ... why lua then (btw, no need for squeezine as there are virtual commands for scaling; not for rotating; an alternative is to define some chars in metapost (see meta-imp-gamesymbols) which gives you plenty freedom > With many thanks and much gratitude, Hans. > > Best wishes > Idris > -- > Professor Idris Samawi Hamid > Department of Philosophy > Colorado State University > Fort Collins, CO 80523 > > > ___________________________________________________________________________________ > If your question is of interest to others as well, please add an entry to the Wiki! > > maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context > webpage : https://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : https://contextgarden.net > ___________________________________________________________________________________ -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 21:48 ` Hans Hagen @ 2023-08-12 22:11 ` Hamid,Idris 2023-08-12 22:16 ` Hamid,Idris 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 22:11 UTC (permalink / raw) To: ntg-context, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 4202 bytes --] On Aug 12, 2023, 3:49 PM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: > you'll figure it out, right? I hope so and I'm working on it -- with your help -) > the demo shows both: x/.y scaling and 90/180/270 rotation Yes, here is what I have so far: ============== % % Hans' original template % \startsetups glyph:iTee % \dontleavehmode\hpack\bgroup % \setbox\scratchbox \ruledhbox \bgroup % \glyphxscale 400 % \glyphyscale 400 % \getglyphstyled{Serif}{T}% choose a font here % \egroup % \scratchheight 2.75\ht\scratchbox % \boxyoffset \scratchbox\scratchheight % \boxorientation\scratchbox\plustwo % \ht \scratchbox\scratchheight % \box\scratchbox % \egroup % \stopsetups % \definesymbol % [iTee] % [\directsetup{glyph:iTee}] % \startTEXpage [offset=1ts,width=2cm] % \ruledhbox {\tfx T \symbol{iTee}} \par % \ruledhbox {T \symbol{iTee}} \par % \ruledhbox {\tfa T \symbol{iTee}} \par % \ruledhbox {\bfd T \symbol{iTee}} % \stopTEXpage \definefontsynonym[MinionRegular][MinionPro-Regular.otf*default] \startsetups glyph:glottalhamzah \dontleavehmode\hpack\bgroup \setbox\scratchbox \ruledhbox \bgroup \glyphxscale 500 \glyphyscale 500 \getglyphstyled{MinionRegular}{c}% choose a font here \egroup \scratchheight 2.03\ht\scratchbox \boxyoffset \scratchbox\scratchheight \boxorientation\scratchbox\plustwo \ht \scratchbox\scratchheight \box\scratchbox \egroup \stopsetups \startsetups glyph:glottalayn \dontleavehmode\hpack\bgroup \setbox\scratchbox \ruledhbox \bgroup \glyphxscale 500 \glyphyscale 500 \getglyphstyled{MinionRegular}{c}% choose a font here \egroup \scratchheight 1.00\ht\scratchbox \boxyoffset \scratchbox\scratchheight % \boxorientation\scratchbox\plustwo \ht \scratchbox\scratchheight \box\scratchbox \egroup \stopsetups \definesymbol [glottalhamzah] [\directsetup{glyph:glottalhamzah}] \definesymbol [glottalayn] [\directsetup{glyph:glottalayn}] \definecolor [transparentgreen] [g=1,t=.7,a=1] \definecolor [transparentred] [r=1,t=.7,a=1] \definecolor [transparentyellow] [y=1,t=.7,a=1] \startTEXpage [offset=1ts,width=2cm] \ruledhbox {\tfx c\symbol{glottalhamzah}c} \par \ruledhbox {c\symbol{glottalhamzah}c} \par \ruledhbox {\tfa c\symbol{glottalhamzah}c} \par \ruledhbox {\bfd c\symbol{glottalhamzah}c} \par \ruledhbox {\tfx c\symbol{glottalayn}c} \par \ruledhbox {c\symbol{glottalayn}c} \par \ruledhbox {\tfa c\symbol{glottalayn}c} \par \ruledhbox {\bfd c\symbol{glottalayn}c} \par \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalhamzah}c}}% \hskip-.09em \ruledhbox {\transparentred c\symbol{glottalhamzah}c}} \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalayn}c}}% \ruledhbox {\transparentred c\symbol{glottalayn}c}} \stopTEXpage ============== Note the \rlap's (see attached pdf): we see that \tfx doesn't scale the \symbol, although \tfa and higher do work. I guess fixing \tfx-symbol interaction will be part of your conversation with Wolfgang -) > well, you wented symbols so Ultimately I just want to be able to type the Unicode symbols for 02BE and 02BF -- ʾ and ʿ -- and get proper results. The overwhelming majority of hq fonts don't have them, and the few that do do them poorly, etc. (So there is no substitute for full control of these transliteration characters.) So even if we use symbols, would like to feed these setups to the CLD template you provided some days ago and feed the final result to \definefontfeature. ======= Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 [-- Attachment #1.2: Type: text/html, Size: 6697 bytes --] [-- Attachment #2: test-scaling-hans.pdf --] [-- Type: application/octet-stream, Size: 9508 bytes --] [-- Attachment #3: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 22:11 ` Hamid,Idris @ 2023-08-12 22:16 ` Hamid,Idris 2023-08-12 22:56 ` Hamid,Idris 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 22:16 UTC (permalink / raw) To: ntg-context, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 1036 bytes --] More precise \rlaps for the previous MWE: \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalhamzah}c}}% \hskip-.075em \ruledhbox {\transparentred c\symbol{glottalhamzah}c}} \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalayn}c}}% \hskip-.075em \ruledhbox {\transparentred c\symbol{glottalayn}c}} -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 On Aug 12, 2023, 4:11 PM -0600, Idris Samawi Hamid ادريس سماوي حامد <ishamid@colostate.edu>, wrote: \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalhamzah}c}}% \hskip-.09em \ruledhbox {\transparentred c\symbol{glottalhamzah}c}} \hbox{\rlap{\ruledhbox {\transparentgreen\tfx c\symbol{glottalayn}c}}% \ruledhbox {\transparentred c\symbol{glottalayn}c}} : Note the \rlap's (see attached pdf): we see that \tfx doesn't scale the \symbol, although \tfa and higher do work. [-- Attachment #1.2: Type: text/html, Size: 2076 bytes --] [-- Attachment #2: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 22:16 ` Hamid,Idris @ 2023-08-12 22:56 ` Hamid,Idris 2023-08-13 12:32 ` Hans Hagen via ntg-context 0 siblings, 1 reply; 10+ messages in thread From: Hamid,Idris @ 2023-08-12 22:56 UTC (permalink / raw) To: ntg-context, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 1580 bytes --] On Aug 12, 2023, 4:20 PM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: > btw, no need for squeezine as there are virtual commands for scaling; not for rotating From your original CLD template: local function topthing(characters,target,base,accent) -- if not characters[target] then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { -- "Ḥ" height = (data1.height or 0) + 0.5*(data2.height or 0), depth = data1.depth, width = data1.width, unicode = target, commands = { { "slot", 0, 0x048 }, { "left", 0.5*(data2.width or 0) + 0.5*(data1.width or 0) }, { "up", 0.5*(data2.height or 0) }, { "slot", 0, 0x2D9, }, }, } end -- end end What are the virtual commands for scaling? Can they be added under "commands =" in the above? Or will that have to go under another local function? Of course, we may still have to insert the \symbol's for rotation, so perhaps better to stick with \symbol's for scaling as well (you know best). Now that the \symbol's for the glottals have been defined with your second template, I need to figure out where/how to plug them into the CLD based on your first template. Best wishes Idris -- Professor Idris Samawi Hamid Department of Philosophy Colorado State University Fort Collins, CO 80523 [-- Attachment #1.2: Type: text/html, Size: 2819 bytes --] [-- Attachment #2: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [NTG-context] Re: Scaling characters without font switching in CLD 2023-08-12 22:56 ` Hamid,Idris @ 2023-08-13 12:32 ` Hans Hagen via ntg-context 0 siblings, 0 replies; 10+ messages in thread From: Hans Hagen via ntg-context @ 2023-08-13 12:32 UTC (permalink / raw) To: Hamid,Idris, mailing list for ConTeXt users; +Cc: Hans Hagen [-- Attachment #1: Type: text/plain, Size: 1435 bytes --] On 8/13/2023 12:56 AM, Hamid,Idris wrote: > On Aug 12, 2023, 4:20 PM -0600, Hans Hagen <j.hagen@xs4all.nl>, wrote: > >> btw, no need for squeezine as there are virtual commands for scaling; not for rotating > > From your original CLD template: > > local function topthing(characters,target,base,accent) > -- if not characters[target] then > local data1 = characters[base] > local data2 = characters[accent] > if data1 and data2 then > characters[target] = { -- "Ḥ" > height = (data1.height or 0) + 0.5*(data2.height or 0), > depth = data1.depth, > width = data1.width, > unicode = target, > commands = { > { "slot", 0, 0x048 }, > { "left", 0.5*(data2.width or 0) + 0.5*(data1.width or 0) }, > { "up", 0.5*(data2.height or 0) }, > { "slot", 0, 0x2D9, }, > }, > } > end > -- end > end a little lesson in efficiency attached Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- [-- Attachment #2: transliteration-lua.tex --] [-- Type: text/plain, Size: 4361 bytes --] \startluacode -- Ṯṯ Ḥḥ Ḫḫ Ḏḏ Šš Ṣṣ Ḍḍ Ṭṭ Ẓẓ Ġġ Āā Īī Ūū ʿ ʾ local function process(characters,target,value) if value == "force" then return true elseif characters[target] then return false else return true end end local function below(characters,value,target,base,accent,left,down,depth) if process(characters,target,value) then local data1 = characters[base] local data2 = characters[accent] if data1 and data2 then characters[target] = { height = data1.height, depth = depth*data2.height, width = data1.width, unicode = target, commands = { { "slot", 0, base }, { "left", left*(data2.width or 0) + 0.5*(data1.width or 0) }, { "down", down*(data2.height or 0) + (data2.height or 0) }, { "slot", 0, accent }, }, } end end end local function ccrap(characters,value,target,base,template,scale,mirror) if process(characters,target,value) then local data1 = characters[base] local data2 = characters[template] if data1 and data2 then local height1 = data1.height local height2 = data2.height local width1 = scale * data1.width characters[target] = { height = height2, depth = 0, width = width1, unicode = target, commands = { { "offset", mirror and width1 or 0, height2 - (mirror and 0 or scale*height1), base, mirror and -scale or scale, mirror and -scale or scale }, }, } end end end -- in principle one can have some extra parameters for shifts but this -- is suboptimal anyway and only meant for minion local function initialize(tfmdata,feature,value) if value then local characters = tfmdata.characters below (characters,value,0x1E6E,0x054,0x0AF,0.50,0.07,0.20) -- Tlinebelow below (characters,value,0x1E6F,0x074,0x0AF,0.45,0.07,0.20) -- tlinebelow below (characters,value,0x1E24,0x048,0x2D9,0.50,0.10,0.30) -- Hdotbelow below (characters,value,0x1E25,0x068,0x2D9,0.50,0.10,0.30) -- hdotbelow below (characters,value,0x1E2A,0x048,0x2D8,0.50,0.10,0.35) -- Hbrevebelow below (characters,value,0x1E2B,0x068,0x2D8,0.50,0.10,0.35) -- hbrevebelow below (characters,value,0x1E0E,0x044,0x0AF,0.50,0.07,0.20) -- Dlinebelow below (characters,value,0x1E0F,0x064,0x0AF,0.40,0.07,0.20) -- dlinebelow below (characters,value,0x1E62,0x053,0x2D9,0.50,0.12,0.30) -- Sdotbelow below (characters,value,0x1E63,0x073,0x2D9,0.40,0.12,0.30) -- sdotbelow below (characters,value,0x1E0C,0x044,0x2D9,0.50,0.12,0.30) -- Ddotbelow below (characters,value,0x1E0D,0x064,0x2D9,0.40,0.12,0.30) -- ddotbelow below (characters,value,0x1E6C,0x054,0x2D9,0.50,0.12,0.30) -- Tdotbelow below (characters,value,0x1E6D,0x074,0x2D9,0.40,0.12,0.30) -- tdotbelow below (characters,value,0x1E92,0x05A,0x2D9,0.50,0.12,0.30) -- Zdotbelow below (characters,value,0x1E93,0x07A,0x2D9,0.40,0.12,0.30) -- zdotbelow ccrap (characters,value,0x02BE,0x063,0x043,0.5,false) -- some fake ccrap (characters,value,0x02BF,0x063,0x043,0.5,true) -- some fake end end local specification = { name = "idrify", description = "idrify", manipulators = { base = initialize, node = initialize, } } fonts.handlers.otf.features.register(specification) \stopluacode % \definefontfeature[default][default][idrify=yes] \definefontfeature[default][default][idrify=force] \showglyphs \startTEXpage[offset=1ts] \definedfont[MinionPro-Regular.otf*default @ 12pt]% Ṯṯ Ḥḥ Ḫḫ Ḏḏ Šš Ṣṣ Ḍḍ Ṭṭ Ẓẓ Ġġ Āā Īī Ūū ʿ ʾ \stopTEXpage \stoptext [-- Attachment #3: Type: text/plain, Size: 495 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-08-13 12:34 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-08-12 14:03 [NTG-context] Scaling characters without font switching in CLD Hamid,Idris 2023-08-12 15:34 ` [NTG-context] " Hans Hagen 2023-08-12 18:05 ` Hamid,Idris 2023-08-12 20:10 ` Hans Hagen via ntg-context 2023-08-12 21:33 ` Hamid,Idris 2023-08-12 21:48 ` Hans Hagen 2023-08-12 22:11 ` Hamid,Idris 2023-08-12 22:16 ` Hamid,Idris 2023-08-12 22:56 ` Hamid,Idris 2023-08-13 12:32 ` Hans Hagen via ntg-context
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).