1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 06:25:01 +00:00

LibGfx: Add Gfx::TextAttributes (and use it in GUI::TextDocumentSpan)

This commit is contained in:
Andreas Kling 2021-01-02 20:31:45 +01:00
parent 0d44ee6f2b
commit 05f5d0dda3
11 changed files with 127 additions and 83 deletions

View file

@ -496,13 +496,13 @@ void TextEditor::paint_event(PaintEvent& event)
for (auto& span : document().spans()) {
if (!span.range.contains(physical_position))
continue;
color = span.color;
if (span.bold) {
color = span.attributes.color;
if (span.attributes.bold) {
if (auto bold_font = Gfx::FontDatabase::the().get(font->family(), font->presentation_size(), 700))
font = bold_font;
}
background_color = span.background_color;
underline = span.is_underlined;
background_color = span.attributes.background_color;
underline = span.attributes.underline;
break;
}
character_rect.set_width(font->glyph_width(code_point) + font->glyph_spacing());