The ansi target, txt table styles, kdesc reference from ref/, typeface and table-width fixes (from dev fcec5e2e77ac)

Since the previous release: Machine::read_string() (the fs::path/std::string
overload pair split); kdesc -c and -u rendered from the ref/ reflection
klammerset; a fit column's tex width measured in TeX over every entry;
@typeface resolving to the family its css declares (a store directory name
now works in html) and hieroglyphs in @unicode_examples set in their
typeface; the ansi target -- plain text with the type styles a terminal can
show, identical to txt once the escape sequences are stripped -- with the
txt @table carrying :header_style, :style and :hline; @block anchoring,
@table spacing and the Image_quality state variable; and the rewritten
doc/klammertext_for_llm.md.
This commit is contained in:
ack committed 2026-09-12 18:11:48 +02:00
1 parent 760fda5470
commit 9b0d0d7897
34 files changed
+895 -394

No files matched your search

+14 -2
View File
@@ -276,9 +276,12 @@ void Document_class::collect_typefaces(const std::string& text)
// located error naming the available typefaces if the store
// does not have it, which is the whole error path for a
// misspelled or uninstalled typeface.
// Compared by directory name: a @typeface may write either
// the family name or the store's directory name, and both
// resolve to the same directory.
bool seen = false;
for (const auto& rf : m_resolved_extra)
if (rf.family_name == name) seen = true;
if (rf.dir_name == name_to_dirname(name)) seen = true;
if (!seen) {
// What a @typeface klammer asked for, and what the store
// resolved it to: a decision the user cannot read off
@@ -293,13 +296,22 @@ void Document_class::collect_typefaces(const std::string& text)
}
}
std::string Document_class::strip_typeface_markers(const std::string& text)
const Resolved_font& Document_class::resolved_typeface(const std::string& name) const
{
for (const auto& rf : m_resolved_extra)
if (rf.dir_name == name_to_dirname(name)) return rf;
// collect_typefaces() resolves every marker before this is asked.
throw Internal_error("Typeface \"" + name + "\" was not resolved");
}
std::string Document_class::resolve_typeface_families(const std::string& text)
{
std::string result {};
size_t pos = 0, start = 0, end = 0;
std::string name {}, scale {};
while (next_typeface_marker(text, pos, start, end, name, scale)) {
result += text.substr(pos, start - pos);
result += resolved_typeface(name).family_name;
pos = end;
}
result += text.substr(pos);
+6 -1
View File
@@ -144,7 +144,12 @@ public:
void collect_typefaces(const std::string& text);
// html: the marker carries no inline switch (the span holds the family
// name), so each is replaced by nothing.
std::string strip_typeface_markers(const std::string& text);
// html: each marker is replaced by the family name the store resolved
// its typeface to (the name as written may be the store's directory
// name, which no @font-face declares).
std::string resolve_typeface_families(const std::string& text);
// The resolved font for a typeface name as a @typeface wrote it.
const Resolved_font& resolved_typeface(const std::string& name) const;
// tex: each distinct (typeface, scale) gets a \newfontfamily command in
// the preamble; the marker is replaced by that command.
std::string resolve_typeface_markers(const std::string& text);
+7 -4
View File
@@ -109,12 +109,15 @@ std::string Document_class::font_definitions()
// var() with such a value computes to inherit, silently losing
// the font.
ss << ":root {\n";
// The family the store RESOLVED, which is what the localized css
// declares -- the name as written may be the store's directory
// name ("crimson-pro"), which matches no @font-face.
if (!m_serif_typeface.empty())
ss << " --serif: \"" << m_serif_typeface << "\", serif;\n";
ss << " --serif: \"" << m_resolved_serif.family_name << "\", serif;\n";
if (!m_sans_typeface.empty())
ss << " --sans-serif: \"" << m_sans_typeface << "\", sans-serif;\n";
ss << " --sans-serif: \"" << m_resolved_sans.family_name << "\", sans-serif;\n";
if (!m_mono_typeface.empty())
ss << " --monospace: \"" << m_mono_typeface << "\", monospace;\n";
ss << " --monospace: \"" << m_resolved_mono.family_name << "\", monospace;\n";
ss << "}\n";
}
// Font-size normalization across families is no longer emitted from
@@ -761,7 +764,7 @@ std::string Document_class::html()
install_resolved_font(rf, output_directory);
}
for (auto& [basename, text] : m_file_components) {
text = strip_typeface_markers(text);
text = resolve_typeface_families(text);
}
auto headings = insert_section_numbers();
insert_section_numbers("___NUM2___", false);