Difference between revisions of "Font Goodies"

From Wiki
Jump to navigation Jump to search
m (category of the page)
m (Text replacement - "pragma-ade.com" to "pragma-ade.nl")
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
For detailed explanation of font goodies read [http://www.pragma-ade.com/general/manuals/fonts-mkiv.pdf fonts-mkiv.pdf] manual.
+
For detailed explanation of font goodies read [http://www.pragma-ade.nl/general/manuals/fonts-mkiv.pdf fonts-mkiv.pdf] manual.
 +
 
 +
Here are some examples of font goodies usage.
 +
 
 +
= Font Coloring =
 +
 
 +
This a simplified example of goodies-002.tex from [[Test suite]] (goodie file of the test is <tt>demo.lfg</tt> in the distribution).
 +
 
 +
Create a goodie file *.lfg, for example:
 +
 
 +
<texcode>
 +
-- name the file fontcolor-greek.lfg
 +
return {
 +
    name = "FontColor",
 +
    comment = "An example of font coloring.",
 +
    colorschemes = {
 +
        default = {
 +
            [1] = {
 +
                force = true,
 +
                list  = {
 +
                    "0x01F40:0x01FD6",
 +
                    "0x0590:0x05FF",
 +
                }
 +
            },
 +
        },
 +
    },
 +
}
 +
</texcode>
 +
 
 +
where "0x0370:0x03FF" and "0x01F40:0x01FD6" are unicode blocks for greek and antient greek. You can also list single character or the adobename of the character from <tt>char-def.lua</tt>.
 +
 
 +
<texcode>
 +
\definefontfeature
 +
  [demo-colored]
 +
  [goodies=fontcolor-greek,
 +
  colorscheme=default,
 +
  featureset=default]
 +
 
 +
\setupbodyfont[dejavu]
 +
 
 +
\startTEXpage[offset=5mm]
 +
    \setfontfeature{demo-colored}%
 +
    \start\resetfontcolorscheme    from ὀρφανῖος, thus\stop\par
 +
    \start\setfontcolorscheme  [1] from ὀρφανῖος, thus\stop\par
 +
    \start\setfontcolorscheme  [2] from ὀρφανῖος, thus\stop\par
 +
    \start\setfontcolorscheme  [3] from ὀρφανῖος, thus\stop\par
 +
    \start\resetfontcolorscheme    from ὀρφανῖος, thus\stop\par
 +
\stopTEXpage
 +
</texcode>
  
  

Latest revision as of 08:29, 2 July 2022

For detailed explanation of font goodies read fonts-mkiv.pdf manual.

Here are some examples of font goodies usage.

Font Coloring

This a simplified example of goodies-002.tex from Test suite (goodie file of the test is demo.lfg in the distribution).

Create a goodie file *.lfg, for example:

-- name the file fontcolor-greek.lfg
return {
    name = "FontColor",
    comment = "An example of font coloring.",
    colorschemes = {
        default = {
            [1] = {
                force = true,
                list  = {
                    "0x01F40:0x01FD6",
                    "0x0590:0x05FF",
                }
            },
        },
    },
}

where "0x0370:0x03FF" and "0x01F40:0x01FD6" are unicode blocks for greek and antient greek. You can also list single character or the adobename of the character from char-def.lua.

\definefontfeature
  [demo-colored]
  [goodies=fontcolor-greek,
   colorscheme=default,
   featureset=default]

\setupbodyfont[dejavu]

\startTEXpage[offset=5mm]
    \setfontfeature{demo-colored}%
    \start\resetfontcolorscheme    from ὀρφανῖος, thus\stop\par
    \start\setfontcolorscheme  [1] from ὀρφανῖος, thus\stop\par
    \start\setfontcolorscheme  [2] from ὀρφανῖος, thus\stop\par
    \start\setfontcolorscheme  [3] from ὀρφανῖος, thus\stop\par
    \start\resetfontcolorscheme    from ὀρφανῖος, thus\stop\par
\stopTEXpage