| 1 | use craterust-analyzer cargo ab_glyph 0.2.32 crate/::{pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point()., OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#, Pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/Point#}; |
| 2 | #[cfg(not(feature = "std"))] |
| 3 | use allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#; |
| 4 | |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 6 | pub(craterust-analyzer cargo ab_glyph 0.2.32 crate/) struct OutlineCurveBuilderrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder# { |
| 7 | lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last.: Pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/Point#, |
| 8 | last_moverust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last_move.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/Point#>, |
| 9 | outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#>, |
| 10 | } |
| 11 | |
| 12 | impl OutlineCurveBuilderrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder# { |
| 13 | #[inline] |
| 14 | pub(craterust-analyzer cargo ab_glyph 0.2.32 crate/) fn take_outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder]take_outline().(mut self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#> { |
| 15 | // some font glyphs implicitly close, e.g. Cantarell-VF.otf |
| 16 | owned_ttf_parserrust-analyzer cargo owned_ttf_parser 0.25.1 crate/::OutlineBuilderrust-analyzer cargo ttf-parser 0.25.1 OutlineBuilder#::closerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]close().(&mut self); |
| 17 | self.outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline. |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | impl owned_ttf_parserrust-analyzer cargo owned_ttf_parser 0.25.1 crate/::OutlineBuilderrust-analyzer cargo ttf-parser 0.25.1 OutlineBuilder# for OutlineCurveBuilderrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder# { |
| 22 | #[inline] |
| 23 | fn move_torust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]move_to().(&mut self, x: f32, y: f32) { |
| 24 | // eprintln!("M {x} {y}"); |
| 25 | self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last. = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x, y); |
| 26 | self.last_moverust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last_move. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last.); |
| 27 | } |
| 28 | |
| 29 | #[inline] |
| 30 | fn line_torust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]line_to().(&mut self, x1: f32, y1: f32) { |
| 31 | // eprintln!("L {x1} {y1}"); |
| 32 | let p1 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x1, y1); |
| 33 | self.outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#::Linerust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#Line#(self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last., p1)); |
| 34 | self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last. = p1; |
| 35 | } |
| 36 | |
| 37 | #[inline] |
| 38 | fn quad_torust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]quad_to().(&mut self, x1: f32, y1: f32, x2: f32, y2: f32) { |
| 39 | // eprintln!("Q {x1} {y1}"); |
| 40 | let p1 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x1, y1); |
| 41 | let p2 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x2, y2); |
| 42 | self.outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#::Quadrust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#Quad#(self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last., p1, p2)); |
| 43 | self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last. = p2; |
| 44 | } |
| 45 | |
| 46 | #[inline] |
| 47 | fn curve_torust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]curve_to().(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x3: f32, y3: f32) { |
| 48 | // eprintln!("C {x1} {y1} {x3} {y3}"); |
| 49 | let p1 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x1, y1); |
| 50 | let p2 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x2, y2); |
| 51 | let p3 = pointrust-analyzer cargo ab_glyph_rasterizer 0.1.10 geometry/point().(x3, y3); |
| 52 | |
| 53 | self.outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline. |
| 54 | .pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#::Cubicrust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#Cubic#(self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last., p1, p2, p3)); |
| 55 | self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last. = p3; |
| 56 | } |
| 57 | |
| 58 | #[inline] |
| 59 | fn closerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/impl#[OutlineCurveBuilder][OutlineBuilder]close().(&mut self) { |
| 60 | // eprintln!("Z"); |
| 61 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(m) = self.last_moverust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last_move..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() { |
| 62 | self.outlinerust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#outline..pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(OutlineCurverust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#::Linerust-analyzer cargo ab_glyph 0.2.32 outlined/OutlineCurve#Line#(self.lastrust-analyzer cargo ab_glyph 0.2.32 ttfp/outliner/OutlineCurveBuilder#last., m)); |
| 63 | } |
| 64 | } |
| 65 | } |