Render legacy XeLaTeX composite TrueType fonts
This commit is contained in:
1 parent
7d460e0fa1
commit
bbeeca0317
11 files changed
+687
-55
No files matched your search
@@ -169,6 +169,7 @@ struct NativeSvgGlyph<'a> {
|
||||
font: &'a str,
|
||||
glyph: &'a str,
|
||||
unicode: Option<&'a str>,
|
||||
device_width: Option<u32>,
|
||||
path: &'a str,
|
||||
scalable: bool,
|
||||
}
|
||||
@@ -210,7 +211,8 @@ impl DisplayItem {
|
||||
slot: *slot,
|
||||
font: paint.program.name(),
|
||||
glyph: &paint.encoding[usize::from(*slot)],
|
||||
unicode: paint.xdv_unicode.as_ref().and_then(|map| map.texts.get(slot)).map(String::as_str),
|
||||
unicode: paint.mapped_text(*slot),
|
||||
device_width: paint.legacy_cid_font().map(|font| font.advance(*slot)),
|
||||
path,
|
||||
scalable: !matches!(
|
||||
paint.program,
|
||||
@@ -544,7 +546,8 @@ impl DisplayList {
|
||||
let mut transparency = SvgTransparency::default();
|
||||
let mut graphics = Vec::new();
|
||||
let mut open_transforms = 0;
|
||||
for item in &self.items {
|
||||
let mut cid_positions = None;
|
||||
for (index, item) in self.items.iter().enumerate() {
|
||||
let fill_opacity = &transparency.fill;
|
||||
let stroke_opacity = &transparency.stroke;
|
||||
match item {
|
||||
@@ -558,14 +561,21 @@ impl DisplayList {
|
||||
font,
|
||||
glyph,
|
||||
unicode,
|
||||
device_width,
|
||||
path,
|
||||
scalable,
|
||||
} = item
|
||||
.native_svg_glyph()
|
||||
.unwrap()
|
||||
.expect("resolved native SVG glyph");
|
||||
let x = x as f64 / 65_536.0;
|
||||
let y = y as f64 / 65_536.0;
|
||||
let [x, y] = if device_width.is_some() {
|
||||
cid_positions.get_or_insert_with(|| crate::pdf::legacy_cid_positions(self))
|
||||
.get(&index).copied().unwrap_or([x as f64, y as f64])
|
||||
} else {
|
||||
[x as f64, y as f64]
|
||||
};
|
||||
let x = x / 65_536.0;
|
||||
let y = y / 65_536.0;
|
||||
let scale = size as f64 / 65_536_000.0;
|
||||
let horizontal_scale = if expansion == 0 {
|
||||
scale
|
||||
|
||||
Reference in new issue
Block a user