Requires: Direct2D.lg32
Sets properties on a D2Layout object for text in a specific range.
D2DefLayout D2Layout, start%, length%, prop, value [, prop, value, …]
D2Layout | : Object |
start%, length% | : integer expression |
prop | : integer |
value | : variant expression |
D2DefLayout allows the application to set multiple font related properties for a range of characters specified by start and length. The prop argument specifies the text layout’s property to change and value specifies the new value for that property. Prop and value must be provided as a pair and multiple prop-value pairs can be used in one command. However, setting properties for a given range may also be split into multiple D2DefLayout commands.
The prop and value pairs can have the following values:
D2TL_FONTNAME | value specifies the font name for the text range. Font must be present on the user’s machine. |
D2TL_WEIGHT | value specifies the weight of the font for the text range. The value must be a DWRITE_FONT_WEIGHT constant: DWRITE_FONT_WEIGHT_THIN, Thin (100). DWRITE_FONT_WEIGHT_EXTRA_LIGHT, Extra-light (200). DWRITE_FONT_WEIGHT_ULTRA_LIGHT, Ultra-light (200). DWRITE_FONT_WEIGHT_LIGHT, Light (300). DWRITE_FONT_WEIGHT_SEMI_LIGHT, Semi-Light (350). DWRITE_FONT_WEIGHT_NORMAL, Normal (400). DWRITE_FONT_WEIGHT_REGULAR, Regular (400). DWRITE_FONT_WEIGHT_MEDIUM, Medium (500). DWRITE_FONT_WEIGHT_DEMI_BOLD, Demi-bold (600). DWRITE_FONT_WEIGHT_SEMI_BOLD, Semi-bold (600). DWRITE_FONT_WEIGHT_BOLD, Bold (700). DWRITE_FONT_WEIGHT_EXTRA_BOLD, Extra-bold (800). DWRITE_FONT_WEIGHT_ULTRA_BOLD, Ultra-bold (800). DWRITE_FONT_WEIGHT_BLACK, Black (900). DWRITE_FONT_WEIGHT_HEAVY, Heavy (900). DWRITE_FONT_WEIGHT_EXTRA_BLACK, Extra-black (950). DWRITE_FONT_WEIGHT_ULTRA_BLACK, Ultra-black (950). |
D2TL_STYLE | value specifies the style of the font for the text range. The value must be a DWRITE_FONT_STYLE constant: DWRITE_FONT_STYLE_NORMAL DWRITE_FONT_STYLE_OBLIQUE DWRITE_FONT_STYLE_ITALIC |
D2TL_FONTSIZE | value specifies the font size (float) of the font for the text range. |
D2TL_STRETCH | Sets the font stretch for text within a specified text range. The value must be a DWRITE_FONT_STRETCH constant: DWRITE_FONT_STRETCH_UNDEFINED, Not known (0). DWRITE_FONT_STRETCH_ULTRA_CONDENSED, Ultra-condensed (1). DWRITE_FONT_STRETCH_EXTRA_CONDENSED, Extra-condensed (2). DWRITE_FONT_STRETCH_CONDENSED, Condensed (3). DWRITE_FONT_STRETCH_SEMI_CONDENSED, Semi-condensed (4). DWRITE_FONT_STRETCH_NORMAL, Normal (5). DWRITE_FONT_STRETCH_MEDIUM, Medium (5). DWRITE_FONT_STRETCH_SEMI_EXPANDED, Semi-expanded (6). DWRITE_FONT_STRETCH_EXPANDED, Expanded (7). DWRITE_FONT_STRETCH_EXTRA_EXPANDED, Extra-expanded (8). DWRITE_FONT_STRETCH_ULTRA_EXPANDED, Ultra-expanded (9). |
D2TL_UNDERLINE | Sets underlining (True/False) for text within a specified text range. The value argument must be boolean. |
D2TL_STRIKETHRU | Sets strikethrough (True/False) for text within a specified text range. The value argument must be boolean. |
D2TL_LOCALENAME | Sets the locale name for text within a specified text range. The value must be a string. |
D2TL_MAXWIDTH | Sets the maximum width of the layout box. The parameters start and length are ignored. |
D2TL_MAXHEIGHT | Sets the maximum height of the layout box. The parameters start and length are ignored. |
D2TL_INLINE | Sets an application-defined inline object of type IDWriteInlineObject stored in an Object variable. The value must be an Object. |
D2TL_TYPOGRAPHY | Sets font typography features for text within a specified text range. The value argument must specify an IDWriteTypography object stored in an Object. |
D2TL_DRAWINGEFFECT | Application-defined drawing effects that apply to the range. This data object will be passed back to the application's drawing callbacks for final rendering. Not supported by Direct2D library. |
D2TL_FONTCOLLECTION | Sets the font collection object IDWriteFontCollection, stored in an Object, within a specified range. |
D2DefLayout is a wrapper for the IDWriteTextLayout set methods. See here.
The opposite of D2DefLayout is D2RLayout which reads the IDWriteTextLayout methods (Get properties).
The formatting options are specified with the D2TextLayout drawing command.
D2Layout, D2TextLayout, D2RLayout
{Created by Sjouke Hamstra; Last updated: 29/03/2020 by James Gaite}