File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -825,8 +825,8 @@ impl<'a> Table<'a> {
825825
826826 /// Returns `true` if the current table has version 0.
827827 ///
828- /// A simple table can only emit `outline_glyph` and `paint`
829- /// [`Painter`] methods.
828+ /// A simple table can only emit `outline_glyph`, `paint`, `push_clip`, and
829+ /// `pop_clip` [`Painter`] methods.
830830 pub fn is_simple ( & self ) -> bool {
831831 self . version == 0
832832 }
@@ -937,15 +937,16 @@ impl<'a> Table<'a> {
937937 let layers = self . layers . slice ( start..end) ?;
938938
939939 for layer in layers {
940+ painter. outline_glyph ( layer. glyph_id ) ;
941+ painter. push_clip ( ) ;
940942 if layer. palette_index == 0xFFFF {
941943 // A special case.
942- painter. outline_glyph ( layer. glyph_id ) ;
943944 painter. paint ( Paint :: Solid ( foreground_color) ) ;
944945 } else {
945946 let color = self . palettes . get ( palette, layer. palette_index ) ?;
946- painter. outline_glyph ( layer. glyph_id ) ;
947947 painter. paint ( Paint :: Solid ( color) ) ;
948948 }
949+ painter. pop_clip ( ) ;
949950 }
950951
951952 Some ( ( ) )
Original file line number Diff line number Diff line change @@ -65,23 +65,35 @@ fn basic() {
6565 assert_eq ! (
6666 paint( 2 ) . unwrap( ) , vec![
6767 Command :: OutlineGlyph ( GlyphId ( 12 ) ) ,
68+ Command :: PushClip ,
6869 Command :: Paint ( c. clone( ) ) ,
70+ Command :: PopClip ,
6971 Command :: OutlineGlyph ( GlyphId ( 13 ) ) ,
70- Command :: Paint ( a. clone( ) ) ]
71- ) ;
72+ Command :: PushClip ,
73+ Command :: Paint ( a. clone( ) ) ,
74+ Command :: PopClip
75+ ] ) ;
7276
7377 assert_eq ! ( paint( 3 ) . unwrap( ) , vec![
7478 Command :: OutlineGlyph ( GlyphId ( 10 ) ) ,
79+ Command :: PushClip ,
7580 Command :: Paint ( c. clone( ) ) ,
81+ Command :: PopClip ,
7682 Command :: OutlineGlyph ( GlyphId ( 11 ) ) ,
83+ Command :: PushClip ,
7784 Command :: Paint ( b. clone( ) ) ,
85+ Command :: PopClip ,
7886 Command :: OutlineGlyph ( GlyphId ( 12 ) ) ,
87+ Command :: PushClip ,
7988 Command :: Paint ( c. clone( ) ) ,
89+ Command :: PopClip ,
8090 ] ) ;
8191
8292 assert_eq ! ( paint( 7 ) . unwrap( ) , vec![
8393 Command :: OutlineGlyph ( GlyphId ( 11 ) ) ,
94+ Command :: PushClip ,
8495 Command :: Paint ( b. clone( ) ) ,
96+ Command :: PopClip ,
8597 ] ) ;
8698}
8799
You can’t perform that action at this time.
0 commit comments