╭ changed ───────────────╮ │src/ui/Repo/Markdown.zig│ ╰────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │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); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────╮ │src/ui/SubTitle.zig│ ╰───────────────────╯ ╭────────────────────────╮ │380 "....",│ │381 }, │ │382 '.' => .{ │ │383 + "....",│ │384 + "....",│ │385 + "....",│ │386 + "....",│ │387 + ".##.",│ │388 + ".##.",│ │389 + }, │ │390 + '?' => .{ │ │391 + ".##.",│ │392 + "#..#",│ │393 + "..#.",│ │394 + ".#..",│ │395 + "....",│ │396 + ".#..",│ │397 + }, │ │398 + '!' => .{ │ │399 + ".##.",│ │400 + ".##.",│ │401 + ".##.",│ │402 + ".##.",│ │403 + "....",│ │404 + ".##.",│ │405 + }, │ │406 + '\'' => .{ │ │407 + ".##.",│ │408 + "..#.",│ │409 + "....",│ │410 + "....",│ │411 + "....",│ │412 + "....",│ │413 + }, │ │414 + ',' => .{ │ │415 + "....",│ │416 "....",│ │417 "....",│ │418 "....",│ ╰────────────────────────╯ ╭──────────────────────────╮ │419 + ".##.", │ │420 + ".#..", │ │421 + }, │ │422 + ':' => .{ │ │423 "....", │ │424 ".##.", │ │425 + "....", │ │426 + "....", │ │427 ".##.", │ │428 + "....", │ │429 + }, │ │430 + '/' => .{ │ │431 + "...#", │ │432 + "...#", │ │433 + "..#.", │ │434 + ".#..", │ │435 + "#...", │ │436 + "#...", │ │437 }, │ │438 else => null,│ │439 }; │ ╰──────────────────────────╯ ╭ changed ───────╮ │src/ui/Title.zig│ ╰────────────────╯ ╭──────────────────────────╮ │492 "......",│ │493 }, │ │494 '.' => .{ │ │495 + "......",│ │496 + "......",│ │497 + "......",│ │498 + "......",│ │499 + "......",│ │500 + "......",│ │501 + "......",│ │502 + "..##..",│ │503 + "..##..",│ │504 + }, │ │505 + '?' => .{ │ │506 + ".####.",│ │507 + "#....#",│ │508 + ".....#",│ │509 + "....#.",│ │510 + "..##..",│ │511 + "..##..",│ │512 + "......",│ │513 + "..##..",│ │514 + "..##..",│ │515 + }, │ │516 + '!' => .{ │ │517 + "..##..",│ │518 + "..##..",│ │519 + "..##..",│ │520 + "..##..",│ │521 + "..##..",│ │522 + "..##..",│ │523 + "......",│ │524 + "..##..",│ │525 + "..##..",│ │526 + }, │ │527 + '\'' => .{ │ │528 + "..##..",│ │529 + "..##..",│ │530 + "...#..",│ │531 "......",│ │532 "......",│ │533 "......",│ ╰──────────────────────────╯ ╭──────────────────────────╮ │534 "......",│ │535 "......",│ │536 "......",│ │537 + }, │ │538 + ',' => .{ │ │539 "......",│ │540 + "......",│ │541 + "......",│ │542 + "......",│ │543 + "......",│ │544 + "......",│ │545 "..##..",│ │546 "..##..",│ │547 + "..#...",│ │548 }, │ │549 + ':' => .{ │ │550 + "......",│ │551 + "......",│ │552 + "..##..",│ │553 + "..##..",│ │554 + "......",│ │555 + "......",│ │556 + "......",│ │557 + "..##..",│ │558 + "..##..",│ │559 + }, │ │560 + '/' => .{ │ │561 + ".....#",│ │562 + "....#.",│ │563 + "....#.",│ │564 + "...#..",│ │565 + "...#..",│ │566 + "..#...",│ │567 + "..#...",│ │568 + ".#....",│ │569 + "#.....",│ │570 + }, │ │571 else => null,│ │572 }; │ │573 } │ ╰──────────────────────────╯