Implement XeTeX OpenType embolden across PDF and SVG
This commit is contained in:
1 parent
45ea5d4297
commit
5a4271364a
7 files changed
+236
-78
No files matched your search
@@ -739,10 +739,18 @@ fn page_content(
|
||||
}
|
||||
let mut native_text: Option<NativeTextRun> = None;
|
||||
let mut tex_text: Option<native_text::NativeText> = None;
|
||||
let mut opentype_text = None;
|
||||
let mut opentype_text = opentype_fonts::TextState::default();
|
||||
let bp_per_unit = list.units.bp(1);
|
||||
let one_inch = (72_000. / (bp_per_unit * f64::from(list.magnification))).round() as i64;
|
||||
for (index, item) in list.items.iter().enumerate() {
|
||||
if opentype_text.is_some() && !matches!(item, DisplayItem::OpenTypeGlyph { .. }) {
|
||||
opentype_fonts::TextRun::finish(&mut opentype_text, &mut content);
|
||||
if !matches!(item, DisplayItem::OpenTypeGlyph { .. }) {
|
||||
opentype_text.finish(&mut content);
|
||||
}
|
||||
if matches!(
|
||||
item,
|
||||
DisplayItem::NativeGlyph { .. } | DisplayItem::MathGlyph { .. } | DisplayItem::Text { .. }
|
||||
) {
|
||||
opentype_text.reset_matrix();
|
||||
}
|
||||
if let DisplayItem::PdfTextSpace { x, y, operation } = item {
|
||||
if let Some(dedicated) = list.pdf_space_plan.as_ref().and_then(|plan| plan.dedicated.as_ref())
|
||||
@@ -858,7 +866,8 @@ fn page_content(
|
||||
DisplayItem::OpenTypeGlyph { x, y, size, font, glyph, text, .. } => {
|
||||
opentype[&font.id].paint(
|
||||
&mut opentype_text, &mut content, font, *glyph, text,
|
||||
*size, *x - h, height - *y - v, list.units.bp(1),
|
||||
*size, *x - h, height - *y - v, bp_per_unit,
|
||||
[one_inch - h, height - one_inch - v],
|
||||
);
|
||||
}
|
||||
DisplayItem::NativeGlyph {
|
||||
@@ -1168,7 +1177,7 @@ fn page_content(
|
||||
}
|
||||
}
|
||||
}
|
||||
opentype_fonts::TextRun::finish(&mut opentype_text, &mut content);
|
||||
opentype_text.finish(&mut content);
|
||||
NativeTextRun::flush(&mut native_text, &mut content);
|
||||
native_text::NativeText::finish(&mut tex_text, &mut content);
|
||||
content.push_str("Q\n");
|
||||
|
||||
Reference in new issue
Block a user