pathfinder
pathfinder copied to clipboard
Raw glyph drawing function for the canvas API
This is useful in some cases.
This is what I added to draw glyphs.
pub fn fill_layout(&mut self, layout: &Layout, transform: Transform2DF) {
let paint_id = self.scene.push_paint(&self.current_state.fill_paint);
drop(self.scene.push_layout(&layout,
&TextStyle { size: self.current_state.font_size },
&transform.post_mul(&self.current_state.transform),
TextRenderMode::Fill,
HintingOptions::None,
paint_id));
}
I am using skribo::Layout here
as that is what is used by push_layout
.
The transformation matrix is used instead of a position, because PDF has two different coordinate spaces for graphics (positive y -> down) and text (positive y -> up)…