Apply XeLaTeX CMaps to document text and embedded fonts
This commit is contained in:
1 parent
af6466cd98
commit
7d460e0fa1
20 files changed
+747
-65
No files matched your search
@@ -168,6 +168,7 @@ struct NativeSvgGlyph<'a> {
|
||||
slot: u8,
|
||||
font: &'a str,
|
||||
glyph: &'a str,
|
||||
unicode: Option<&'a str>,
|
||||
path: &'a str,
|
||||
scalable: bool,
|
||||
}
|
||||
@@ -209,6 +210,7 @@ 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),
|
||||
path,
|
||||
scalable: !matches!(
|
||||
paint.program,
|
||||
@@ -555,6 +557,7 @@ impl DisplayList {
|
||||
slot,
|
||||
font,
|
||||
glyph,
|
||||
unicode,
|
||||
path,
|
||||
scalable,
|
||||
} = item
|
||||
@@ -569,11 +572,13 @@ impl DisplayList {
|
||||
} else {
|
||||
scale * f64::from(1000 + expansion) / 1000.0
|
||||
};
|
||||
let label = if scalable {
|
||||
crate::type1::glyph_unicode_text(glyph).unwrap_or_default()
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
let label = unicode.map(std::borrow::Cow::Borrowed).unwrap_or_else(|| {
|
||||
std::borrow::Cow::Owned(if scalable {
|
||||
crate::type1::glyph_unicode_text(glyph).unwrap_or_default()
|
||||
} else {
|
||||
String::new()
|
||||
})
|
||||
});
|
||||
use std::fmt::Write as _;
|
||||
write!(
|
||||
out,
|
||||
|
||||
Reference in new issue
Block a user