Unicode sequences, @typeface, and the font/typeface distinction

A run of Unicode code points now needs one pair of carets, not one pair
each: ^9053 53EF 9053^ renders the characters adjacently, and a single
character inside such a run stands for itself.  An invalid code point is
an error naming the position that wrote it, rather than an apology
rendered into the finished document; noncharacters are refused alongside
surrogates; and a code point that lands on a Klammertext special is safe
through the re-reads that assemble a document.  The character tables now
produce the precomposed form, so a diacritic written as ^a" and one typed
directly are the same text to a search or a copy-paste.

"kdesc -u" describes how to write a Unicode character, with tables of
glyphs beside the codes that produce them.  It is new and not yet
complete: it predates the sequence form and the typeface klammer below.

A typeface and a style are no longer both called "font".  A typeface is a
family resolved by name; a style code is the one letter naming a type
style.  So @document takes :serif_typeface and its siblings, a table takes
:style, captions take :caption_style and :caption_size, the uniform scale
is :text_scale, and the command is "kdesc --typeface".  This renames
arguments a document may already use; an old name is a located error
rather than a silent omission.

@typeface sets a passage in another typeface for the length of that
passage:

    @typeface Noto Sans Egyptian Hieroglyphs | ^132AA 133CF^ :scale 1.5 @

Writing the klammer is the whole declaration -- the document resolves the
typeface, embeds it in what it produces, and carries its license along.
Two typefaces for scripts no text font covers now ship with Klammertext:
Noto Sans Egyptian Hieroglyphs and Noto Sans Cuneiform.  Every typeface in
the distribution now carries its license file.

(from dev 61e598698891)
This commit is contained in:
ack committed 2026-08-25 23:30:55 +02:00
1 parent 37b6ba1c4f
commit af29bbf7ac
47 files changed
+1921 -135

No files matched your search

+2 -2
View File
@@ -206,8 +206,8 @@
:grid.bool false
:cell_hpos.cell_hpos
:justify.table_justify
:header_font.font i
:font.font_list
:header_style.style_code i
:style.style_code_list
:colspan.table_span
:rowspan.table_span
:calc.table_calc
+14 -14
View File
@@ -84,7 +84,7 @@ class Table(klammer_base.Klammer_base):
self.apply_formats()
self.cell_hpos = extend(parse_hpos(self.K_target, self.cell_hpos), self.row_size)
#self.cell_hpos = self.cell_hpos.split(";")
self.font = extend(self.font, self.row_size)
self.style = extend(self.style, self.row_size)
# In html, a 'fit' column mixed with sized columns must be clamped
# to its widest entry (tex's \widthof semantics) or it absorbs the
# window width: its cells get nowrap (class Wfit; see table.css).
@@ -445,7 +445,7 @@ class Table(klammer_base.Klammer_base):
self.column_widths = []
for col_i in range(len(self.cells[0])):
longest = ""
longest_font = "r"
longest_style = "r"
for row_i in range(len(self.cells)):
cell = self.cells[row_i][col_i]
# A colspan anchor's text spans several columns and must
@@ -456,9 +456,9 @@ class Table(klammer_base.Klammer_base):
longest_in_line = lines[-1]
if len(longest_in_line) > len(longest):
longest = longest_in_line
longest_font = cell.font
if longest_font != "r":
longest = font.tex_fontify(longest, longest_font, 1.0)
longest_style = cell.font
if longest_style != "r":
longest = font.tex_fontify(longest, longest_style, 1.0)
self.column_widths.append(longest)
# ---- :hpos -------------------------------------------------------------
@@ -500,9 +500,9 @@ class Table(klammer_base.Klammer_base):
for cell_i, cell in enumerate(row):
rspan = self.span_count(self.s_rowspan, cell_i, row_i)
cspan = self.span_count(self.s_colspan, row_i, cell_i)
font = self.font[cell_i]
font = self.style[cell_i]
if row_i == 0 and self.header:
font = self.header_font
font = self.header_style
# A span anchor's right and bottom borders come from the
# boundary at the END of the merged region.
right_i = cell_i + max(cspan, 1)
@@ -589,9 +589,9 @@ class Table(klammer_base.Klammer_base):
if self.number or self.caption:
result = html_util.add_caption(
result, "Table", self.number, self.caption,
self.caption_font, hpos=self.hpos,
self.caption_style, hpos=self.hpos,
side=self.caption_side,
font_size=self.caption_font_size, max_width="100%",
font_size=self.caption_size, max_width="100%",
offset=self.offset)
else:
result.attr("style", "max-width: 100%")
@@ -606,9 +606,9 @@ class Table(klammer_base.Klammer_base):
if table_width:
result.attr("style", f"{layout}width: 100%")
result = html_util.add_caption(
result, "Table", self.number, self.caption, self.caption_font,
result, "Table", self.number, self.caption, self.caption_style,
hpos=self.hpos, side=self.caption_side,
font_size=self.caption_font_size, width=table_width,
font_size=self.caption_size, width=table_width,
offset=self.offset)
else:
# An uncaptioned table still gets the position container, so
@@ -757,7 +757,7 @@ class Table(klammer_base.Klammer_base):
def make_caption(self):
column_count = str(len(self.rows[0]))
caption = latex_util.make_caption_text(
self.number, "Table", self.caption, self.caption_font, self.caption_font_size)
self.number, "Table", self.caption, self.caption_style, self.caption_size)
result = "\\multicolumn{" + column_count + "}{c}{\\parbox{\\tableboxwidth}{"
result += "\\vspace*{8pt}\\centering\\small\\em "
result += caption
@@ -836,8 +836,8 @@ class Table(klammer_base.Klammer_base):
result = latex_util.add_caption(
result, "Table", self.number, self.caption, "\\tableboxwidth",
hpos=self.hpos, side=self.caption_side,
font_symbol=self.caption_font,
font_size=self.caption_font_size, offset=self.offset)
font_symbol=self.caption_style,
font_size=self.caption_size, offset=self.offset)
else:
result = latex_util.caption_wrapper(result, self.hpos, offset=self.offset)
result = measure + result