Hello Pablo,

thank you for showing the way; unfortunately, still something is missing:

- the resulting file uses LMRoman instead of WorkSans,

- the log confirms:

"selectfont > The requested font 'WorkSans' has no files for the 'tf' alternative, Latin Modern is used instead".

- Note that all WorkSans files:

  work-sans.bold.otf
  work-sans.bold-italic.otf
  work-sans.light.otf
  work-sans.light-italic.otf

are placed in the same directory as the main source file. (I can zip them and upload somewhere for testing purposes.)

- In your code bellow, I cann't see any link to any work-sans .otf file name.

- Does it mean that that ConTeXt browses its database of "known" fonts, searches for all fonts which contain "identification" as "WorkSans" (given from your \definefontfamily...[WorkSans])?

- Also, I see assignments [tf={style:light},it={style:lightitalic}]:

  - Should also an assignment for "bf=[style:...]" be provided?

- How ConTeXt gets to know from "it={style:lightitalic}" that file "work-sans.light-italic.otf" should be used?

Sorry for elementary questions, I'm still "in captivity" of swtching fonts, their styles and font sizes by clicking a combo in Word toolbar (although I quit using Word about 15 ys ago). And although I'm aware of different dealing with fonts in TeX (and in professional typesetting in general), it's often difficult for me to imagine how exactly TeX switchches fonts, what is the relationship between (and how the comands cooperate) \definefontfamily, \setupbodyfontenvironment, \setupbodyfont, \definefontsynonym, \definefont, typescripts, simplefonts module and also what is the relations among parameters to the-above commands.

So any practical samples (e.g. here discussed) helps me much.

Best regards,

Lukas


Hi Lukas,

I think this is what you might need:

    \definefontfamily
        [mainface]
        [rm]
        [WorkSans]
        [tf={style:light}, it={style:lightitalic}]
    \setupbodyfont[mainface]

    \setupbodyfontenvironment
        [default]
        [a=1.2,
         b=2.4,
         c=3.6,
         d=4.8,
         em=italic]

    \starttext
    \startTEXpage[offset=1em]
        roman\\
        {\bf bold}\\
        {\it italic}\\
        {\bi bold italic}\\
        {\tfa roman}\\
        {\bfb bold}\\
        {\itc italic}\\
        {\bid bold italic}\\
    \stopTEXpage
    \stoptext

I hope it helps,

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
___________________________________________________________________________________
open source     > level 1, order 1, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system          > 
system          > ConTeXt  ver: 2019.12.31 11:28 MKIV beta  fmt: 2020.1.8  int: 
english/english
system          > 
system          > 'cont-new.mkiv' loaded
open source     > level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > beware: some patches loaded from cont-new.mkiv
close source    > level 2, order 2, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'

system          > jobfiles > using path: d:\\Lukas\\ConTeXt\\Styles
system          > files > jobname 't-Font', input 
'D:\\Lukas\\Jobs\\KatMostu.TP\\Test\\t-Font.mkiv', result 't-Font'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > level 2, order 3, name 
'D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv'
selectfont      > The requested font 'WorkSans' has no files for the 'tf' 
alternative, Latin Modern is used instead.
fonts           > preloading modern-designsize (math)
fonts           > typescripts > unknown library 'modern-designsize'
fonts           > 'fallback modern-designsize mm 12pt' is loaded
fonts           > preloading modern-designsize (mono)
fonts           > 'fallback modern-designsize tt 12pt' is loaded
backend         > xmp > using file 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml'
pages           > flushing realpage 1, userpage 1, subpage 1
close source    > level 2, order 3, name 
'D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv'
close source    > level 1, order 3, name 
'd:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'

system          > start used files

system          > text: t-Font

system          > stop used files


system          > start used files

system          >    1: filename=char-prv.lua filetype=tex format=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/char-prv.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/char-prv.lua 
usedmethod=database
system          >    2: filename=cont-yes.mkiv filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv 
usedmethod=database
system          >    3: filename=publ-imp-default.lua filetype=scripts 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua
 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua
 usedmethod=database
system          >    4: filename=cont-new.mkiv filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv 
usedmethod=database
system          >    5: filename=lang-exc.lua filetype=scripts 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua 
usedmethod=database
system          >    6: filename=lang-us.lua filetype=scripts 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua 
usedmethod=database
system          >    7: filename=D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv 
foundname=D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv 
fullname=D://Lukas/Jobs/KatMostu.TP/Test/t-Font.mkiv usedmethod=direct
system          >    8: filename=lm.lfg filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg 
usedmethod=database
system          >    9: filename=lmroman10-regular filetype=otf format=otf 
foundname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-regular.otf 
fullname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-regular.otf 
usedmethod=database
system          >   10: filename=lmroman10-bold filetype=otf format=otf 
foundname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-bold.otf 
fullname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-bold.otf 
usedmethod=database
system          >   11: filename=lmroman10-italic filetype=otf format=otf 
foundname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-italic.otf 
fullname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-italic.otf 
usedmethod=database
system          >   12: filename=lmroman10-bolditalic filetype=otf format=otf 
foundname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-bolditalic.otf
 
fullname=d:/Ctx-Beta/tex/texmf/fonts/opentype/public/lm/lmroman10-bolditalic.otf
 usedmethod=database
system          >   13: filename=pdftex.map filetype=map format=map 
foundname=d:/Ctx-Beta/tex/texmf/fonts/map/pdftex/plain/pdftex.map 
fullname=d:/Ctx-Beta/tex/texmf/fonts/map/pdftex/plain/pdftex.map 
usedmethod=database
system          >   14: filename=lpdf-pdx.xml filetype=tex 
foundname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml 
fullname=d:/Ctx-Beta/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml 
usedmethod=database

system          > stop used files


system          > start commandline options

system          > currentrun="1"
system          > fulljobname="D:\\Lukas\\Jobs\\KatMostu.TP\\Test\\t-Font.mkiv"
system          > input="D:\\Lukas\\Jobs\\KatMostu.TP\\Test\\t-Font.mkiv"
system          > kindofrun="1"
system          > maxnofruns="9"
system          > nonstopmode="true"
system          > path="d:\\Lukas\\ConTeXt\\Styles"
system          > texmfbinpath="d:/Ctx-Beta/tex/texmf-mswin/bin"

system          > stop commandline options


system          > start commandline files

system          >    1: D:\\Lukas\\Jobs\\KatMostu.TP\\Test\\t-Font.mkiv

system          > stop commandline files


modules         > start used modules


modules         > stop used modules


mkiv lua stats  > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: 
d:/Ctx-Beta/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > resource resolver: loadtime 0.000 seconds, 0 scans with 
scantime 0.000 seconds, 0 shared scans, 14 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 450 modules (0.230 sec), 93 tables 
(0.013 sec), 543 chunks (0.243 sec)
mkiv lua stats  > traced context: maxstack: 1393, freed: 0, unreachable: 1393
mkiv lua stats  > cleaned up reserved nodes: 56 nodes, 9 lists of 442
mkiv lua stats  > node memory usage: 3 glue, 3 kern, 4 penalty, 17 attribute, 
51 glue_spec, 6 attribute_list, 2 temp, 2 user_defined
mkiv lua stats  > node list callback tasks: 8 unique task lists, 7 instances 
(re)created, 57 calls
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > jobdata time: 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats  > callbacks: internal: 166, file: 167, direct: 2, late: 0, 
function 513, total: 848
mkiv lua stats  > randomizer: resumed with value 0.86941528320313
mkiv lua stats  > result saved in file: t-Font.pdf, compresslevel 3, 
objectcompresslevel 1
mkiv lua stats  > loaded patterns: en::1, load time: 0.000
mkiv lua stats  > loaded fonts: 4 files: lmroman10-bold.otf, 
lmroman10-bolditalic.otf, lmroman10-italic.otf, lmroman10-regular.otf
mkiv lua stats  > font engine: otf 3.110, afm 1.513, tfm 1.000, 11 instances, 7 
shared in backend, 1 common vectors, 6 common hashes, load time 0.031 seconds 
mkiv lua stats  > used platform: mswin, type: windows, binary subtree: 
texmf-mswin
mkiv lua stats  > used engine: luatex version 1.112 with functionality level 
7226, banner: this is luatex, version 1.11.2 (tex live 2019/w32tex)
mkiv lua stats  > control sequences: 45371 of 65536 + 100000
mkiv lua stats  > lua properties: engine: lua 5.3, used memory: 55 MB, ctx: 54 
MB, max: unknown MB), hash chars: min(32,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 0.452 seconds, 1 processed pages, 1 shipped pages, 
2.212 pages/second

\definefontfamily
  [mainface]
  [rm]
  [WorkSans]
  [tf={style:light},it={style:lightitalic}]

\setupbodyfont[mainface]

\setupbodyfontenvironment
  [default]
  [a=1.2,
   b=2.4,
   c=3.6,
   d=4.8,
   em=italic]

\starttext
  \startTEXpage[offset=1em]
    roman\\
    {\bf bold}\\
    {\it italic}\\
    {\bi bold italic}\\
    {\tfa roman}\\
    {\bfb bold}\\
    {\itc italic}\\
    {\bid bold italic}\\
  \stopTEXpage
\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to