Paint inline NFSS runs with their own faces
This commit is contained in:
1 parent
67898d6a8a
commit
53fabe95db
6 files changed
+223
-17
No files matched your search
@@ -250,6 +250,16 @@ fn escape(text: &str) -> String {
|
||||
.replace('>', ">")
|
||||
}
|
||||
|
||||
fn paragraph_face(font: ParagraphFont) -> FontFace {
|
||||
match font {
|
||||
ParagraphFont::Roman => FontFace::Roman,
|
||||
ParagraphFont::Bold => FontFace::Bold,
|
||||
ParagraphFont::Italic => FontFace::Italic,
|
||||
ParagraphFont::Mono => FontFace::Mono,
|
||||
ParagraphFont::Sans => FontFace::Sans,
|
||||
}
|
||||
}
|
||||
|
||||
fn character_text(character: char) -> String {
|
||||
match character {
|
||||
'\u{FB00}' => "ff".to_owned(),
|
||||
@@ -441,13 +451,7 @@ impl Page {
|
||||
y += *height + *depth;
|
||||
}
|
||||
VerticalItem::Paragraph(paragraph) => {
|
||||
let face = match paragraph.font {
|
||||
ParagraphFont::Roman => FontFace::Roman,
|
||||
ParagraphFont::Bold => FontFace::Bold,
|
||||
ParagraphFont::Italic => FontFace::Italic,
|
||||
ParagraphFont::Mono => FontFace::Mono,
|
||||
ParagraphFont::Sans => FontFace::Sans,
|
||||
};
|
||||
let face = paragraph_face(paragraph.font);
|
||||
let lines = paragraph.lines.len().max(1) as i64;
|
||||
let line_height = (paragraph.height / lines).max(1);
|
||||
let size = 10 * 65_536;
|
||||
@@ -479,7 +483,7 @@ impl Page {
|
||||
HorizontalItem::Box(box_) => {
|
||||
if let Some(character) = box_.character {
|
||||
list.push(DisplayItem::Text {
|
||||
font: face,
|
||||
font: box_.font.map_or(face, paragraph_face),
|
||||
x,
|
||||
y: baseline,
|
||||
size,
|
||||
|
||||
Reference in new issue
Block a user