@@ -222,7 +222,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
222222 // canvas matrix so cm/q/Q changes later in the same text object don't shift it.
223223 if ( textRenderingMode . IsClip ( ) )
224224 {
225- using var glyphPath = GetPath ( drawTypeface , renderUnicode ) ;
225+ using var glyphPath = GetPath ( drawTypeface , renderUnicode , font . IsVertical ) ;
226226 if ( ! glyphPath . IsEmpty )
227227 {
228228 AppendGlyphToTextClipPath ( glyphPath ) ;
@@ -257,7 +257,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
257257 throw new ArgumentNullException ( $ "Expecting a { nameof ( PatternColor ) } but got '{ nonStrokingColor . GetType ( ) } '.") ;
258258 }
259259
260- using ( var path = GetPath ( drawTypeface , renderUnicode ) )
260+ using ( var path = GetPath ( drawTypeface , renderUnicode , font . IsVertical ) )
261261 {
262262 ShowVectorFontGlyph ( path , strokingColor , nonStrokingColor ,
263263 textRenderingMode , in TransformationMatrix . Identity , in TransformationMatrix . Identity ) ;
@@ -270,7 +270,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
270270 DrawWithSoftMask ( softMask ! , currentState . BlendMode , ( ) =>
271271 {
272272 using var skFont = drawTypeface . Typeface . ToFont ( 1f ) ;
273- _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , SKPoint . Empty , SKTextAlign . Left , skFont , innerPaint ) ;
273+ _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , skFont , innerPaint , font . IsVertical ) ;
274274 } ) ;
275275 }
276276 else
@@ -280,7 +280,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
280280
281281 using ( var skFont = drawTypeface . Typeface . ToFont ( 1f ) )
282282 {
283- _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , SKPoint . Empty , SKTextAlign . Left , skFont , fillPaint ) ;
283+ _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , skFont , fillPaint , font . IsVertical ) ;
284284 }
285285 }
286286 }
@@ -310,7 +310,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
310310 DrawWithSoftMask ( softMask ! , currentState . BlendMode , ( ) =>
311311 {
312312 using var skFont = drawTypeface . Typeface . ToFont ( 1f ) ;
313- _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , SKPoint . Empty , SKTextAlign . Left , skFont , innerStrokePaint ) ;
313+ _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , skFont , innerStrokePaint , font . IsVertical ) ;
314314 } ) ;
315315 }
316316 else
@@ -321,7 +321,7 @@ private void ShowNonVectorFontGlyph(IFont font, IColor? strokingColor, IColor? n
321321
322322 using ( var skFont = drawTypeface . Typeface . ToFont ( 1f ) )
323323 {
324- _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , SKPoint . Empty , SKTextAlign . Left , skFont , strokePaint ) ;
324+ _canvas . DrawShapedText ( drawTypeface . Shaper , renderUnicode , skFont , strokePaint , font . IsVertical ) ;
325325 }
326326 }
327327 }
@@ -501,11 +501,13 @@ private static SKRect GetType3GlyphBoundingBox(IReadOnlyList<IGraphicsStateOpera
501501 return SKRect . Create ( - 1000 , - 1000 , 2000 , 2000 ) ;
502502 }
503503
504- private static SKPath GetPath ( SkiaFontCacheItem fontItem , string unicode )
504+ private static SKPath GetPath ( SkiaFontCacheItem fontItem , string unicode , bool vertical )
505505 {
506506 using ( var skFont = fontItem . Typeface . ToFont ( 1f ) )
507507 {
508- var shaped = fontItem . Shaper . Shape ( unicode , skFont ) ;
508+ var shaped = vertical
509+ ? fontItem . Shaper . ShapeVertical ( unicode , skFont )
510+ : fontItem . Shaper . Shape ( unicode , skFont ) ;
509511
510512 var combinedPath = new SKPath ( ) ;
511513 for ( int i = 0 ; i < shaped . Codepoints . Length ; ++ i )
@@ -520,7 +522,7 @@ private static SKPath GetPath(SkiaFontCacheItem fontItem, string unicode)
520522 combinedPath . AddPath ( glyphPath , in matrix ) ;
521523 }
522524 }
523-
525+
524526 return combinedPath ;
525527 }
526528 }
0 commit comments