mirror of
https://github.com/servo/servo.git
synced 2025-07-24 07:40:27 +01:00
use au in TextFragment (#32653)
This commit is contained in:
parent
fe58a5f0a3
commit
4357751f28
3 changed files with 4 additions and 5 deletions
|
@ -961,7 +961,7 @@ fn rgba(color: AbsoluteColor) -> wr::ColorF {
|
||||||
fn glyphs(
|
fn glyphs(
|
||||||
glyph_runs: &[Arc<GlyphStore>],
|
glyph_runs: &[Arc<GlyphStore>],
|
||||||
mut baseline_origin: PhysicalPoint<Au>,
|
mut baseline_origin: PhysicalPoint<Au>,
|
||||||
justification_adjustment: Length,
|
justification_adjustment: Au,
|
||||||
) -> Vec<wr::GlyphInstance> {
|
) -> Vec<wr::GlyphInstance> {
|
||||||
use fonts_traits::ByteIndex;
|
use fonts_traits::ByteIndex;
|
||||||
use range::Range;
|
use range::Range;
|
||||||
|
@ -983,7 +983,7 @@ fn glyphs(
|
||||||
}
|
}
|
||||||
|
|
||||||
if glyph.char_is_word_separator() {
|
if glyph.char_is_word_separator() {
|
||||||
baseline_origin.x += justification_adjustment.into();
|
baseline_origin.x += justification_adjustment;
|
||||||
}
|
}
|
||||||
baseline_origin.x += glyph.advance();
|
baseline_origin.x += glyph.advance();
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ impl TextRunLineItem {
|
||||||
font_key: self.font_key,
|
font_key: self.font_key,
|
||||||
glyphs: self.text,
|
glyphs: self.text,
|
||||||
text_decoration_line: self.text_decoration_line,
|
text_decoration_line: self.text_decoration_line,
|
||||||
justification_adjustment: state.justification_adjustment,
|
justification_adjustment: state.justification_adjustment.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ use fonts::{FontMetrics, GlyphStore};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::Length;
|
|
||||||
use style::values::specified::text::TextDecorationLine;
|
use style::values::specified::text::TextDecorationLine;
|
||||||
use style::Zero;
|
use style::Zero;
|
||||||
use webrender_api::{FontInstanceKey, ImageKey};
|
use webrender_api::{FontInstanceKey, ImageKey};
|
||||||
|
@ -75,7 +74,7 @@ pub(crate) struct TextFragment {
|
||||||
pub text_decoration_line: TextDecorationLine,
|
pub text_decoration_line: TextDecorationLine,
|
||||||
|
|
||||||
/// Extra space to add for each justification opportunity.
|
/// Extra space to add for each justification opportunity.
|
||||||
pub justification_adjustment: Length,
|
pub justification_adjustment: Au,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue