Win2D 1.15.0 – custom Arabic text layouts, CanvasFontSet(uri), and deexperimentalization


Win2D version 1.15.0 is now available on NuGet (for Windows 10 or Windows / Phone 8.1) and GitHub.

 

Breaking changes in this release

  • Renamed some methods of CanvasTextAnalyzer, to improve consistency:
    • ChooseFonts -> GetFonts
    • AnalyzeBidi -> GetBidi
    • AnalyzeBreakpoints -> GetBreakpoints
    • AnalyzeNumberSubstitutions -> GetNumberSubstitutions
    • AnalyzeScript -> GetScript
    • AnalyzeGlyphOrientations -> GetGlyphOrientations
  • CanvasFontSet.TryFindFontFace is no longer supported on Windows 8.1.  It had some strange corner case behaviors there, and the other APIs this is most commonly used alongside were new in Win10, so we decided to make TryFindFontFace exclusive to Win10 as well.

New features

  • Custom text layout example now handles right-to-left and bidirectional as well as left-to-right languages, and includes some Arabic text to demonstrate this in action.  Many thanks to my friend Nazeeh for helping us get that right!

  • ICanvasImage.GetBounds now takes an ICanvasResourceCreator rather than CanvasDrawingSession.  This is a breaking change at the ABI level, but source compatible since CanvasDrawingSession implements ICanvasResourceCreator.
  • CanvasVirtualControl and CanvasAnimatedControl now show the proper clear color in the Visual Studio XAML designer.

 

Bugfixes

  • CanvasAnimatedControl.Size is now synchronized with the update/draw loop
  • CanvasControl now handles E_SURFACE_CONTENTS_LOST on BeginDraw

 

Removed the "experimental" warning tag from some of our older, more stable APIs

  • CanvasBitmap.CreateFromSoftwareBitmap
  • CanvasComposition
  • CanvasDevice.GetSharedDevice
  • CanvasDrawingSession.DrawInk
  • CanvasGeometry:
    • CreateInk
    • CreateText
  • CanvasGradientMesh
  • CanvasGradientMeshPatchEdge
  • CanvasGradientMeshPatch
  • CanvasDrawingSession.DrawGradientMesh
  • CanvasSpriteBatch
  • CanvasSpriteFlip
  • CanvasSpriteOptions
  • CanvasSpriteSortMode
  • CanvasDrawingSession.CreateSpriteBatch
  • CanvasTextFormat:
    • LastLineWrapping
    • LineSpacingMode
    • GetSystemFontFamilies
    • OpticalAlignment
    • VerticalGlyphOrientation
  • CanvasTextLayout:
    • ClusterMetrics
    • LineMetrics
    • LineSpacingMode
    • LayoutBoundsIncludingTrailingWhitespace
    • MaximumBidiReorderingDepth
  • CanvasLineSpacingMode
  • CanvasLineMetrics
  • CanvasClusterMetrics
  • CanvasClusterProperties

 


Comments (4)

  1. Chris says:

    Thanks!  Glad to see some of these finalized.

    "CanvasAnimatedControl.Size is now synchronized with the update/draw loop"

    Does this happen at the end of a loop or the beginning?  And does this refer to the actual control resizing or just the reporting of the size of the resized control?

  2. DamyanPepper says:

    The way it works for a single tick on the game loop is:

    * read the control's size

    * one or more updates

    * ensure swap chain is correct size

    * draw

    During the update/draw process the Size property could potentially return a different size to the one read at the beginning of the loop.  Now it is fixed to return the same size.

  3. Chris says:

    Thanks for the clarification Damyan

  4. Phil says:

    In Canvas_Draw, ProduceBidiOrdering is called after the text is split across layoutBoxes. With Arabic this works for Arial font but with Lucida Console font the word order can change as the line length changes. Not being able to read Arabic I don’t know if this is intended. Should ProduceBidiOrdering be called prior to splitting into layoutBoxes so word order is independent of line length?

Skip to main content