CadTrueTypeFonts
from OpenCAD2D import CadTrueTypeFonts
class CadTrueTypeFonts(System.Object) · CadTrueTypeFonts in the .NET reference
The TrueType fonts of the machine by their family, as AutoCAD's Text Style dialog lists them and writes a style of one: the file of its regular face (group 3, arial.ttf) beside the family (the style's extended data, Arial). Each font file of the Fonts folder of Windows and of the user's is read once, for its family and face in its name table, and for the other names the family has in other languages (CadTrueTypeFonts.LocalNamesOf).
Properties and fields
Families
Families: ClassVar[System.Collections.Generic.IReadOnlyList[str]]
Gets the families found, in ordinal order, letters of either case the same: Arial, Calibri, ...
MeasureWidth
MeasureWidth: ClassVar[System.Func[str, bool, bool, str, float] | None]
Gets or sets how wide the canvas draws letters of a TrueType font one unit high at their own width: given the family (null for the canvas's own font), whether bold, whether italic and the letters, the width from the start of the first to the end of the last. The runs of an MTEXT in several looks are put one after another by it; where it is null, as in a test with no canvas, a letter is taken as 0.6 of the height wide, as a text's picking box takes it. The window sets it to the canvas's own measure.
Methods
FamilyOf
@staticmethod
def FamilyOf(fileName: str) -> str
Gets the family of a font file a style names (arial.ttf gives Arial); null where none found has that file.
FileOf
@staticmethod
def FileOf(family: str) -> str
Gets the file a style of a family is written with: the regular face's file name, as arial.ttf for Arial; the family's name with .ttf where no file of it is found.
LocalNamesOf
@staticmethod
def LocalNamesOf(family: str) -> System.Collections.Generic.IReadOnlyList[str]
Gets the names a family has besides its English one, as its name table holds them (family name 1, and the typographic family name 16 where there is one), in every language: DotumChe has 돋움체, Malgun Gothic 맑은 고딕, MS Gothic MS ゴシック, Arial none. A name equal to the English one, or to another, letters of either case the same, is left out; the names come in the order of their language ids, so the same fonts give the same list on every read.
WarmUp
@staticmethod
def WarmUp() -> Any
Reads the fonts of the machine ahead (the scan of the Fonts folders that the first of CadTrueTypeFonts.Families, CadTrueTypeFonts.FileOf, CadTrueTypeFonts.FamilyOf or CadTrueTypeFonts.LocalNamesOf makes: some 2 500 files on a machine with many fonts, a second or more from a cold disk), on a thread of its own at below normal priority, and gives back at once. The app calls it after its window has drawn, so that the Text Style dialog and the MTEXT editor find the list read. A call that comes while the scan runs waits for it and does not repeat it, and the lists are the same whether or not this was called. Calling it again gives the same task.