Top Level Namespace

Defined Under Namespace

Modules: FontFamily, FontMetrics, Markup, RSyntaxTree Classes: MarkupParser, RSTError, String

Constant Summary collapse

ETYPE_NODE =

==========================

rsyntaxtree.rb

Facade of rsyntaxtree library. When loaded by a driver script, it does all the necessary 'require' to use the library. Copyright (c) 2007-2026 Yoichiro Hasebe yohasebe@gmail.com

1
ETYPE_LEAF =
2
SUBSCRIPT_CONST =
0.7
FONT_SCALING =
2
LINE_SCALING =
1
BLINE_SCALING =
2
WHITESPACE_BLOCK =
""
DEFAULT_OPTS =
{
  format: "png",
  leafstyle: "auto",
  fontstyle: "sans",
  fontsize: 16,
  linewidth: 1,
  vheight: 2.0,
  color: "modern",
  symmetrize: "off",
  transparent: "off",
  polyline: "off",
  hide_default_connectors: "off",
  mirror: "off",
  tidy: "off",
  hspacing: 1.0,
  direction: "ttb"
}.freeze
SCRIPT_FAMILIES_SANS =

Font family lists shared by the SVG output and the Pango-based text measurement. Each entry is an ordered list of family names; the FontFamily helpers format it for SVG (quoted) or for Pango::FontDescription#family (unquoted). Keeping a single source guarantees that measurement and rendering resolve through the same fallback chain.

Scripts beyond Latin and CJK are named explicitly rather than left to the generic fallback, because the generic fallback is not the same font on every machine: on Alpine the Arabic block was picked up by Noto Sans Math, which has the glyphs but no joining rules and so rendered Arabic as isolated letters, while on Debian the same text fell to DejaVu Sans. A family is listed here when (i) the gallery has an example in that script, or (ii) a concrete environment-dependent failure has been reported for it. Anything else stays with the generic fallback — an unbounded list is unmaintainable.

["Noto Sans Arabic", "Noto Sans Hebrew", "Noto Sans Devanagari", "Noto Sans Thai", "Noto Sans Khmer"].freeze
SCRIPT_FAMILIES_SERIF =

Noto has no serif Arabic; Naskh is its serif-like counterpart, with Noto Sans Arabic behind it for systems that ship one but not the other.

["Noto Naskh Arabic", "Noto Sans Arabic", "Noto Serif Hebrew", "Noto Serif Devanagari", "Noto Serif Thai", "Noto Serif Khmer"].freeze
EMOJI_FAMILIES =

Monochrome emoji faces only. Colour emoji fonts carry their glyphs as bitmap or COLR tables, which Pango happily measures but librsvg does not draw, so a colour font in this list would give a figure whose emoji are blank or blobbed.

This holds only where Pango resolves through fontconfig. On macOS it goes through CoreText, which answers every emoji codepoint with Apple Color Emoji whatever the chain asks for; emoji figures have to be generated elsewhere.

["OpenMoji", "OpenMoji Color", "OpenMoji Black", "Noto Emoji"].freeze
MATH_FAMILIES_SANS =

Mathematical alphanumerics (U+1D400–) label heads such as the little v of vP. Neither Noto Sans nor Noto Serif covers the block, so without these entries the glyphs came from whatever the machine happened to offer — Noto Sans Math on Alpine, DejaVu Serif on Debian/Ubuntu, STIX Two Math on macOS. Noto Sans Math is the only Noto face that covers the block and it is a sans design, so the serif style asks for a serif source first. Listed after the script families: Noto Sans Math also claims the Arabic block without joining rules, and must never be reached before Noto Sans Arabic.

["Noto Sans Math"].freeze
MATH_FAMILIES_SERIF =
["DejaVu Serif", "Noto Sans Math"].freeze
FONT_FAMILIES =
{
  sans:  (["Noto Sans", "Noto Sans JP", "Noto Sans CJK JP"] + SCRIPT_FAMILIES_SANS + MATH_FAMILIES_SANS + EMOJI_FAMILIES + ["sans-serif"]).freeze,
  serif: (["Noto Serif", "Noto Serif JP", "Noto Serif CJK JP"] + SCRIPT_FAMILIES_SERIF + MATH_FAMILIES_SERIF + EMOJI_FAMILIES + ["serif"]).freeze,
  # Noto ships no monospaced faces for these scripts, so the mono style borrows
  # the proportional ones rather than dropping to the generic fallback.
  mono:  (["Noto Sans Mono", "Noto Sans JP", "Noto Sans Mono CJK JP"] + SCRIPT_FAMILIES_SANS + MATH_FAMILIES_SANS + EMOJI_FAMILIES + ["monospace"]).freeze,
  # The cjk style puts a full-coverage CJK family first, for text that mixes
  # Han, Hangul and kana. Latin falls back to the same Noto faces the sans
  # style uses. (Before 1.8.0 this was WQY Zen Hei.)
  cjk:   (["Noto Sans CJK JP", "Noto Sans", "Noto Sans JP"] + SCRIPT_FAMILIES_SANS + MATH_FAMILIES_SANS + EMOJI_FAMILIES + ["sans-serif"]).freeze
}.freeze