╭ changed ───────────────╮ │src/ui/Repo/Markdown.zig│ ╰────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │25 .data = data, │ │26 .dir = if (std.mem.lastIndexOfScalar(u8, file_path, '/')) |slash| file_path[0..slash] else "",│ │27 .page_arena = page_arena, │ │28 - .fonts = !hasNonAsciiHeading(doc.blocks), │ │28 + .fonts = !hasUncoveredHeading(doc.blocks), │ │29 }; │ │30 var box = try builder.blocksBox(doc.blocks, true); │ │31 errdefer box.deinit(allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │246 } │ │247 }; │ │248 │ │249 -// whether any heading, however nested, has non-ascii text, in which case │ │250 -// none use the title fonts so they all look alike │ │251 -fn hasNonAsciiHeading(blocks: []const md.Block) bool { │ │249 +// whether any heading the title fonts would draw, however nested, has a char │ │250 +// they lack, in which case none use them so they all look alike │ │251 +fn hasUncoveredHeading(blocks: []const md.Block) bool { │ │252 for (blocks) |block| switch (block) { │ │253 - .heading => |heading| for (heading.inlines) |run| { │ │254 - for (run.text) |c| if (!std.ascii.isAscii(c)) return true; │ │253 + .heading => |heading| if (heading.level <= 2) for (heading.inlines) |run| { │ │254 + if (!ui.Title.covers(run.text) or !ui.SubTitle.covers(run.text)) return true;│ │255 }, │ │256 - .quote => |inner| if (hasNonAsciiHeading(inner)) return true, │ │256 + .quote => |inner| if (hasUncoveredHeading(inner)) return true, │ │257 .list => |list| for (list.items) |item| { │ │258 - if (hasNonAsciiHeading(item.blocks)) return true; │ │258 + if (hasUncoveredHeading(item.blocks)) return true; │ │259 }, │ │260 else => {}, │ │261 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────╮ │279 } │ │280 │ │281 // a heading in the title font when it fits, else the subtitle font, else│ │282 -// bold text. the fonts only cover plain text of their own glyphs. │ │282 +// bold text. │ │283 pub const Heading = struct { │ │284 focus: *Focus, │ │285 text: RichText, │ ╰──────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │305 has_links = has_links or span.link.len > 0; │ │306 } │ │307 const text = std.mem.trim(u8, plain.items, " "); │ │308 - if (!fonts or level > 2 or has_links or text.len == 0 or !ui.Title.covers(text) or !ui.SubTitle.covers(text)) return self;│ │308 + if (!fonts or level > 2 or has_links or text.len == 0) return self; │ │309 │ │310 if (level == 1) { │ │311 const title = try ui.Title.init(page_arena, text, .solid); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯