pathfinder icon indicating copy to clipboard operation
pathfinder copied to clipboard

Raw glyph drawing function for the canvas API

Open pcwalton opened this issue 5 years ago • 1 comments

This is useful in some cases.

pcwalton avatar Jun 22 '19 16:06 pcwalton

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)…

s3bk avatar Jun 24 '19 15:06 s3bk