@@ -100,18 +100,20 @@ public override void RenderGlyph(IFont font,
100100 {
101101 var transformedGlyphBounds = PerformantRectangleTransformer
102102 . Transform ( renderingMatrix , textMatrix , transformationMatrix , characterBoundingBox . GlyphBounds ) ;
103-
103+
104104 var transformedPdfBounds = PerformantRectangleTransformer
105105 . Transform ( renderingMatrix ,
106106 textMatrix ,
107107 transformationMatrix ,
108- new PdfRectangle ( 0 , 0 , characterBoundingBox . Width , 0 ) ) ;
108+ new PdfRectangle ( 0 , 0 , characterBoundingBox . Width , UserSpaceUnit . PointMultiples ) ) ;
109109
110110 if ( ParsingOptions . ClipPaths )
111111 {
112112 var currentClipping = currentState . CurrentClippingPath ;
113113 if ( currentClipping ? . IntersectsWith ( transformedGlyphBounds ) == false )
114+ {
114115 return ;
116+ }
115117 }
116118
117119 Letter letter = null ;
@@ -141,20 +143,26 @@ public override void RenderGlyph(IFont font,
141143 }
142144 }
143145
146+ // The bbox is assumed to be valid if the width or the height is greater than 0.
147+ // The whitespace letter can have a 0 height and still be a valid bbox.
148+ // This could change in the future (i.e. AND instead of OR).
149+ bool isBboxValid = transformedGlyphBounds . Width > double . Epsilon ||
150+ transformedGlyphBounds . Height > double . Epsilon ;
151+
144152 // If we did not create a letter for a combined diacritic, create one here.
145153 if ( letter is null )
146154 {
147155 letter = new Letter (
148156 unicode ,
149- transformedGlyphBounds ,
157+ isBboxValid ? transformedGlyphBounds : transformedPdfBounds ,
150158 transformedPdfBounds . BottomLeft ,
151159 transformedPdfBounds . BottomRight ,
152160 transformedPdfBounds . Width ,
153161 fontSize ,
154162 font . Details ,
155- currentState . FontState . TextRenderingMode ,
156- currentState . CurrentStrokingColor ! ,
157- currentState . CurrentNonStrokingColor ! ,
163+ currentState . FontState . TextRenderingMode ,
164+ currentState . CurrentStrokingColor ! ,
165+ currentState . CurrentNonStrokingColor ! ,
158166 pointSize ,
159167 TextSequence ) ;
160168 }
0 commit comments