![]() ![]() You can subtract the Roman baseline from the central baseline to get the offset between the two. Use the IDWriteTextAnalyzer1::GetBaseline method to get the numerical values of the baselines you specify. You need access to both the central and Roman baseline to align the text correctly. If you draw all of the text along the central baseline, the Latin text appears to float in the middle of the line. Because you're drawing the text vertically, you need to get some more info so that the Latin text is drawn correctly. Drawing text verticallyįinally, you need to lay out and draw the text. Because the AnalyzeVerticalGlyphOrientation method returns a run with vertical glyphs, you need to call GetVerticalGlyphVariants, which returns the vertically oriented glyph IDs in place of the current glyph IDs. This method returns the corresponding glyph indices for the characters in the example. To transition from characters to glyphs, you call GetGlyphIndices. In the example so far, there are 3 runs: one with vertical glyphs and two without. Now that you know the run contains vertical glyphs, you need to get access to those glyphs. In the example image, this function returns 3 runs: "English", "中国", and "English." Going from characters to glyphs The source and sink take in the glyph runs and let you check if they are oriented vertically or not.Īfter you implement your source and sink, you call the AnalyzeVerticalGlyphOrientation method. To determine the orientation of the text you have, you need to implement the IDWriteTextAnalysisSink1 and IDWriteTextAnalysisSource1 interfaces. This difference in orientation is seen in the example here. On the other hand, in a vertical layout, the Chinese text remains upright, and the Latin text is rotated 90 degrees. For example, in traditional horizontal layout, both the Latin text and the Chinese text are oriented vertically. Analyzing character orientationĮvery character has a preferred character orientation, or the direction that the character should be oriented in any directional layout. Then you can create and draw a vertical IDWriteTextLayout object. To draw the text vertically, pass DWRITE_READING_DIRECTION_TOP_TO_BOTTOM to the IDWriteTextFormat::SetReadingDirection method and DWRITE_FLOW_DIRECTION_RIGHT_TO_LEFT to the IDWriteTextFormatSetFlowDirection method. ![]() You can draw vertical text with Direct2D by using the DrawTextLayout methods. Starting with the Windows 8, DirectWrite has a number of new APIs that allow you to use vertical text in your apps. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |