Implement native automatic font expansion for paragraphs
This commit is contained in:
1 parent
1dd745afcb
commit
ebbc9e2c17
24 files changed
+632
-34
No files matched your search
@@ -94,7 +94,12 @@ impl Bounds {
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum PaintKind {
|
||||
Glyph { font: u32, slot: u8 },
|
||||
Glyph {
|
||||
font: u32,
|
||||
slot: u8,
|
||||
#[serde(default, skip_serializing_if = "crate::native_font::unexpanded")]
|
||||
expansion: i32,
|
||||
},
|
||||
Rule,
|
||||
PdfImage { page: usize },
|
||||
}
|
||||
@@ -341,12 +346,13 @@ impl SourceMap {
|
||||
PaintKind::Glyph {
|
||||
font: font.id.index(),
|
||||
slot: *slot,
|
||||
expansion: font.expansion,
|
||||
},
|
||||
Bounds {
|
||||
x: *x,
|
||||
y: y.checked_sub(h)
|
||||
.ok_or("source map glyph position overflow")?,
|
||||
width: scale(metrics.width(c))?,
|
||||
width: scale(font.advance(*slot))?,
|
||||
height: h
|
||||
.checked_add(d)
|
||||
.ok_or("source map glyph height overflow")?,
|
||||
|
||||
Reference in new issue
Block a user