Re: [NTG-context] new font trickery
On 1/24/2021 6:16 PM, Pablo Rodriguez wrote: But MuPDF and SumtraPDF (based on MuPDF) display it fine. An (in the meantime probably old version of) okular (windows) also shows it ok ... time to ditch (or update) evince I guess. 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
On 1/24/21 5:51 PM, Hans Hagen wrote: >> [...] >> I only get black cows and black squares for bitmap images. >> >> I think this isn’t intended. > Works ok here ... so are the images found? Buggy pdf viewer? Many thanks for your reply, Hans. Images are found, but not with "directory=default", but with "location=default". Evince doesn’t display the images or colors. Acrobat for Linux doesn’t display it either (this is why I thought it might be a bug). But MuPDF and SumtraPDF (based on MuPDF) display it fine. Sorry for the noise and many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
On 1/24/21 4:44 PM, Hans Hagen wrote: > \starttext > > \setupexternalfigure[directory={global,default}] > > \startsetups box:demo:103 > \externalfigure[cow-brown.pdf][height=12pt] > \stopsetups > > \startsetups box:demo:104 > \externalfigure[cow-black.pdf][height=10pt] > \stopsetups > > \startsetups box:demo:105 > \externalfigure[mill.png][height=12pt] > \stopsetups > > \startsetups box:demo:106 > \externalfigure[hacker.jpg][height=12pt] > \stopsetups Sorry, Hans, but I’m afraid it doesn’t work for me. To find images, I neeed to add: \setupexternalfigure[location={default}] I only get black cows and black squares for bitmap images. I think this isn’t intended. Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] new font trickery
Hi Jairo, (to the list for those who want to play with it) In addition to the metapost fotn subsystem I also made a tex variant. That one is currently based on setups. So, we now can use mp as well as tex to make fonts. Of course this is mostly for special purposes and for fun but both are quite efficient. \starttext \setupexternalfigure[directory={global,default}] \startsetups box:demo:103 \externalfigure[cow-brown.pdf][height=12pt] \stopsetups \startsetups box:demo:104 \externalfigure[cow-black.pdf][height=10pt] \stopsetups \startsetups box:demo:105 \externalfigure[mill.png][height=12pt] \stopsetups \startsetups box:demo:106 \externalfigure[hacker.jpg][height=12pt] \stopsetups \registerboxglyph category {demo} unicode 103 \relax % rather low level for now \registerboxglyph category {demo} unicode 104 \relax % rather low level for now \registerboxglyph category {demo} unicode 105 \relax % rather low level for now \registerboxglyph category {demo} unicode 106 \relax % rather low level for now \definefontfeature[whatever][box=demo] \definedfont[Serif*whatever] % \enabletrackers[fonts.collecting] \startTEXpage%[offset=0pt] %\hbox{g}% \hbox{\char103}% \hbox{\char104}% \stopTEXpage \startsetups box:demo:whatever \startMPcode picture p ; p := image (draw figure "hacker.jpg" ysized 10pt); fill boundingbox p enlarged .5pt randomized 2pt withcolor "darkgray" ; clip p to boundingbox p enlarged -1pt randomized 2pt ; draw p ; \stopMPcode \stopsetups % in current font! \iffontchar\font\privatecharactercode{demo:whatever}\else \setboxglyph { category {demo} name {demo:whatever} setups {box:demo:whatever} }% \fi \startTEXpage[offset=10pt] \char\privatecharactercode{demo:whatever}% \stopTEXpage \startTEXpage%[offset=0pt] \ruledhbox{\char103} \ruledhbox{\char104} \ruledhbox{\char105} \ruledhbox{\char106} \stopTEXpage \dorecurse{1000}{ \char 103\relax \space \char 104\relax \space \char 105\relax \space \char 106\relax \space } \page \setupalign[verytolerant,flushleft] \dorecurse{100}{ #1: \glyph yoffset -2pt `i\relax \glyph yoffset -3pt `j\relax\space } \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
On 12/23/2020 11:36 AM, mf wrote: When I started using ConTeXt, font management gave me headaches because I expected fonts to be indefinitely scalable and not to be designed in advance at fixed sizes. That came from using software like Word, where fonts are scalable at any size. Since I had no background in typesetting, I took vector, indefinitely scalable fonts for granted. With that mindset a 48pt font is just a 10pt font scaled 4.8 times. Then I knew about optical sizes, which were the norm with lead glyphs, because they came in heavy physical sets. And so the notion that as the font body gets bigger, the stroke gets thinner (so it's not just scaling). I like this feature because it should make playing with sizes easier for people while lighter for machines, even though fixed sizes to be designed in advance enforce discipline and consistency in documents. Of course we can still keep the abstraction because we can define sizes, think of: \definescaledfont[bfe][xscale=2000,yscale=6000,style=bf] (just made this feature work in two directions, not yet uploaded). But you're right, we have to educate users in this. Actually, I was wondering iif this could be abused to do vertical hz ... filling a vbox / page with subtle scaling. It should be relatively easy to implement, so when I'm bored ... 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] new font trickery
When I started using ConTeXt, font management gave me headaches because I expected fonts to be indefinitely scalable and not to be designed in advance at fixed sizes. That came from using software like Word, where fonts are scalable at any size. Since I had no background in typesetting, I took vector, indefinitely scalable fonts for granted. With that mindset a 48pt font is just a 10pt font scaled 4.8 times. Then I knew about optical sizes, which were the norm with lead glyphs, because they came in heavy physical sets. And so the notion that as the font body gets bigger, the stroke gets thinner (so it's not just scaling). I like this feature because it should make playing with sizes easier for people while lighter for machines, even though fixed sizes to be designed in advance enforce discipline and consistency in documents. Massi ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] new font trickery
Hi, I finally decided to start an experiment that I had on my todo list for a while: dynamically scaling fonts. Below is an example of usage (plus some comment). In that example some 2*200 different font sizes are used which in mkiv demands 400 font definitions. This costs time and memory. The example below runs (on my old laptop) in less than 2 seconds and only uses two instances. I bet that our CJK users will love it. I post it because: (1) I need to discuss the impact with Wolfgang ... how do we integrate this. We can for instance define some sizes (\tfa \tfb ...) differently. (2) I want to see if average performance improves on huge documents with many fonts / sizes (that is for Massimiliano to test). (3) Are there side effects? It does work for math (rather neat trickery) but maybe we need an additional configration for that. (4) I considered several variants but for now use a low level \glyphscale command that takes a number (in goodl old tex tradition a scale of 1.0 is entered as 1000). (5) The implementation can be improved a bit (performance wise). There is a bit more overhead involved but usually I can compensate that. (6) It will not be backported to MKIV so one can only test in LMTX. it's a bit of a mix between engine and context features. (7) There can be bugs (unforseen side effects, or typos in the somewhat quick patches in the source). Consider it an experiment, but so far I'm rather satisfied, Hans EXAMPLE \setuplayout[middle] \setupbodyfont[pagella,10pt] \setupalign[verytolerant,stretch] \setupwhitespace[big] \starttext \startbuffer \definescaledfont[bfe][scale=2000,style=bf] \setuphead[chapter][style=\bfe] \dostepwiserecurse {10} {2020} {10} { \title{Here we go #1!} \start \glyphscale#1\relax \setupinterlinespace \samplefile{ward}% \bf \samplefile{ward} \par \stop \page } \stopbuffer \getbuffer \title{Scaled fonts} Although \CONTEXT\ is quite efficient with fonts there is always room for improvement. However, after years of finetuning the font mechanisms there was not that much room left. This made me think of a different approach to scaling. Nowadays fonts seldom come in design sizes. Also, in \CONTEXT\ \MKIV\ and therefore \LMTX\ we always had so called dynamic features: apply additional features locally, although that comes with a small penalty in performance, it saves additional font instances. It is a good approach for the occasional small stretch of glyphs, like small capped logos and such. We now can also do dynamic font scaling, which means that we don't need to define a new font instance when the same feature set is used. Or course in addition to this features one can still use the dynamic features. This means that for instance chapter titling can use the bodyfont instance and just apply additional scaling. Although for a normal run the number of loaded fonts is normally small, and the number of instances also isn't that impressive it can happen in a large document that you end up with a few dozen. That number can now be reduced to half a dozen. Of course there can be side effects, whcich is why it's currently tagged as experimental. There is also a small performance hit because we now need to track it but that is gained back because we load less fonts and have less glyph runs. It even works in math, although there some different trickery is needed. \typebuffer \stoptext - 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 / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___