# @@@state font_dirs.list :create Directories containing local fonts @@@ @@@state font_dirs :desc Directories containing local fonts @@@ @@@argtype style_code | a style code: one letter naming a type style :pattern r^|i^|b^|s^|t^|c @@@ @@@argtype style_code_list | a list of style codes. One or more of 'r' (roman), 'i' (italic), 'b' (bold), 's' (sans-serif), 't' (typewriter or monospace) or 'c' (code) for each cell in a row. If there are fewer style codes than cells in a row, the last code is repeated. Extra codes are ignored. :pattern ('style_code'^|\s)+ :python_cast (lambda s : s.split()) :default r @@@ #[ @font was retired 2026-08-25 and replaced by @typeface. It switched the main font PERMANENTLY (a bare \setmainfont, no group) for tex, and for html and txt its body was "*fontname*" -- so it printed the NAME of the font as document text instead of setting anything. @typeface is the temporary, all-target replacement. ]# @@typeface.k name | text :scale.float 1.0 :middle.bool :lift.length : A temporary change of typeface for *text*: the typeface *name* is resolved in the Klammertext font store (the directories of KLAMMERTEXT_FONTS, then the distribution's own), and the document declares and localizes it automatically -- writing this klammer is the only declaration needed. *scale* multiplies the size of the surrounding text as it appears, the same in html and pdf, which a script whose glyphs are drawn small usually wants. *middle* centres *text* on the surrounding line instead of standing it on the baseline -- for a script with no baseline relationship to the text, such as hieroglyphs, whose font declares a tall ascender that would otherwise open up every line the glyphs sit in. Html only: in tex a row is already as tight as its tallest glyph. Never for a Latin typeface, whose baseline must stay shared with the text around it. *lift* shifts *text* up by a length (down when negative), in em, pt or px -- the correction for a font that draws its glyphs off the baseline, which is a property of the font and so belongs in the klammer that names it: Noto Sans Egyptian Hieroglyphs floats its signs and wants about 0.15em, NewGardinerOmni stands them on the baseline and wants none. Html and tex alike; the txt target has no vertical position. The change ends with *text*: nothing after it is affected. Under the txt target a typeface cannot be expressed at all, so *text* is emitted unchanged. @@ @@typeface.html,tex,txt :: @eval font.Typeface(K) @ @@ @@r.k text : Use the current Roman font for *text* @@ @@r.html :: *text* @@ @@r.tex :: \textrm{*text*} @@ @@r.txt :: *text* @@ @@b.k text : Use a bold weight of the current font for *text* @@ @@b.html :: *text* @@ @@b.tex :: \textbf{*text*} @@ # The txt bodies of @b, @i, @u and @ri emit STYLE MARKERS around the text # (phases.txt_style_marker), which the txt target strips and the ansi # target turns into escape sequences -- see the ansi target in # sks/target/target.k. "#-" glues the marker to the text. @@b.txt :: @eval phases.txt_style_marker("bold") @ #- *text* #- @eval phases.txt_style_marker("bold", False) @ @@ @@i.k text : Use an italic style of the current font for *text* @@ @@i.html :: *text* @@ @@i.tex :: \emph{*text*} @@ # \begin{emph}{*text*}\end{emph} @@ @@i.txt :: @eval phases.txt_style_marker("italic") @ #- *text* #- @eval phases.txt_style_marker("italic", False) @ @@ @@t.k text : Use the currently defined monospace font for *text* @@ @@t.html :: *text* @@ @@t.tex :: \texttt{*text*} @@ @@t.txt :: *text* @@ @@s.k text : Use the currently defined sans-serif font for *text* @@ @@s.html :: *text* @@ @@s.tex :: \textsf{*text*} @@ @@s.txt :: *text* @@ @@u.k text : Underline *text* in the current font @@ @@u.tex :: \underline{\botstrut{2pt}*text*} @@ @@u.txt :: @eval phases.txt_style_marker("underline") @ #- *text* #- @eval phases.txt_style_marker("underline", False) @ @@ @@ri.k text : Use a roman italic font for *text* (to override monospace environment) @@ @@ri.html :: *text* @@ @@ri.tex :: \textrm{\textit{*text*}} @@ @@ri.txt :: @eval phases.txt_style_marker("italic") @ #- *text* #- @eval phases.txt_style_marker("italic", False) @ @@ @@ts.k scale.float | text : Resize *text* by *scale* @@ # @@ts.tex :: {\scalefont{*scale*}\em *text*} @@ @@ts.tex :: \scalefont{*scale*}{*text*} @@ @@ts.html :: *text* @@ @@ts.txt :: *text* @@ @@leading.k n.float : Change LaTeX leading to *n*, multiple of the current line height @@ #@@leading.tex :: \renewcommand{\baselinestretch}{*n*} @@ @@leading.tex :: \setstretch{*n*} @@ @@default_font.k : Default font for documents @@ @@default_font.tex :: # \setmainfont[Ligatures=TeX,Numbers=Lining]{Garamond Libre} \setmainfont{Garamond Libre} @@ #[ Before 2026-08-25 every one of these bodies substituted "*cjk*" while the declaration named the parameter "text", so @cjk raised "Variable "cjk" not defined" under EVERY target -- it had never worked. Rewritten on @typeface, which is what it was reaching for. The typeface it names is NOT part of the distribution (a usable Noto Sans CJK is some 16-20 MB per weight, and Chinese line breaking needs more than a typeface -- xeCJK for the tex path), so this klammer errors with the list of available typefaces until one is installed with "kdesc --typeface install". That is the honest behaviour: the klammer states what it needs and the store reports what it has. @@cjk.k text : Set *text* in a typeface that supports CJK @@ @@cjk.html,tex,txt :: @typeface Noto Sans CJK SC | *text* @ @@ ]# # Only defining on Chinese style for now; could be parameterized. @@chinese.k text :scale.float 1 : Set *text* in a Chinese font @@ @@chinese.html,tex,txt :: @typeface Noto Serif SC :scale *scale* | *text* @ @@ # Egyptian hieroglyphs @@egyptian.k text :scale.float 1.75 : Set *text* in an Egyptian hieroglyph font @@ @@egyptian.html,tex,txt :: @typeface NewGardinerOmni :scale *scale* :middle | *text* @ @@ # @@egyptian.html,tex,txt :: @typeface Noto Sans Egyptian Hieroglyphs :scale *scale* :middle | *text* @ @@ @@fraktur.k s : Set text *s* in Fraktur @@ @@fraktur.tex :: \textfrak{*s*} @@ @@euro.k f : The Euro symbol, followed by the amount *f* @@ @@euro.html :: &^#x20AC;*f* @@ @@euro.tex,txt :: €\,*f* @@ # TODO: This needs to use MathJax. # @@math s :center.bool false : @i *s* @ @@ @@sub.k base | script : Subscript: @sub x 2 @ @@ @@sub.html,tex :: @eval font.Subsuper(K, "sub") eval@ @@ @@sup.k base | script : Superscript: @sup x 2 @ @@ @@sup.html,tex :: @eval font.Subsuper(K, "sup") eval@ @@ @@copyright.k : Copyright symbol: © @@ @@copyright.html :: © @@ @@copyright.tex :: {\copyright} @@ @@registered.k : Registered symbol: ® @@ @@registered.html :: ® @@ @@registered.tex :: \textsuperscript{\textregistered} @@ @@trademark.k : Trademark symbol: ™ @@ @@trademark.html :: ™ @@ @@trademark.tex :: \texttrademark{} @@ @@pi.k : Greek letter pi @@ @@pi.html :: π @@ @@pi.tex :: $\pi$ @@ @@rightarrow.k : Right-pointing arrow: @rightarrow@ @@ @@rightarrow.html :: &^#8594; @@ @@rightarrow.tex :: $\rightarrow$ @@ @@dot.k : Vertically entered dot @@ @@dot.tex :: $\cdot$ @@ @@dot.html :: ^00B7^ @@ @@dot.txt :: ^00B7^ @@