Table of Contents

Class CadFonts

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

The fonts a document's text is drawn in, found as AutoCAD finds them: a text style's SHX font (romans.shx, txt read as txt.shx) and big font in Folders in their order and then in the Fonts folder beside OpenCAD2D.Core.dll (CadSupportFolders), read once and kept; a TrueType typeface as the canvas has it, else a font file of that family in those folders, a file also in the Fonts folder of Windows; a font named in Substitutions looked for as the font it is given for, as AutoCAD's font mapping file does; and one not found replaced by Replacement, as AutoCAD's FONTALT replaces it (a TrueType font not found, by the canvas's drawing font, as AutoCAD maps it through Windows), said once a font through FontMissing. The one font carried is the presenter's own single-stroke font, BuiltIn; no folder of AutoCAD's is looked in unless the user lists it.

public sealed class CadFonts
Inheritance
CadFonts
Inherited Members

Remarks

Fonts of no folders and no replacement are off: every style is drawn as before fonts were read, its TrueType typeface or file by the canvas and an SHX font in the canvas's own font, and nothing is said. A file found that is no SHX font, or cannot be read, is said once at Debug and taken as not found; nothing throws. The fonts read are kept for every document by their path, the size and time of their file, at most 48 at once, the one used longest ago let go first.

Constructors

CadFonts(IEnumerable<string>, string, IEnumerable<KeyValuePair<string, string>>, Func<string, bool>)

Makes the fonts of a document.

Fields

BuiltInName

The name the presenter's own font goes by, as a replacement or a style's font: opencad2d, with or without .shx. No file has it on disk; a file of that name in a folder looked in is passed over for it.

BuiltInTitle

The title of the presenter's own font, as the line saying a font not found names it: OpenCAD2D ISO.

Properties

BuiltIn

Gets the presenter's own single-stroke font, OpenCAD2D ISO (BuiltInName), drawn as an SHX font is: upright lettering in the proportions of ISO 3098 type B (TCVN 7284), ASCII 32 to 126 with the degree, plus-minus, square, diameter and dash signs and the Vietnamese letters, 242 letters. Its capitals reach Above 100 units above the baseline and its descenders 30 below: "ABC123" 10 high is 10 high and its advances add to 42.5 (A 8, B 7, C 6.5, each digit 7); the compiled file is 8 685 bytes. AutoCAD 2021's textbox of TEXT "ABC123" in it, from the point the text starts at, is (1.0000, -0.6299) to (42.2488, 10.7063) at 10 high and (10.0000, -6.2992) to (422.4882, 107.0630) at 100 high: the arcs of the C, 2 and 3 reach past the baseline and the capitals' top.

DefaultFolders

Gets the folders a drawing's fonts start with: none. SHX fonts are read from the folders the user adds in Global settings' Folder preference, then from the Fonts folder beside OpenCAD2D.Core.dll and its subfolders; a TrueType file is looked for in the Fonts folder of Windows as well, last. The drawing's own folder is not looked in, and nor are AutoCAD's Fonts folders.

Folders

Gets the folders the user set, which fonts are looked for in, in order, before the Fonts folder beside the dll.

IsOff

Gets whether fonts are off: no folders and no replacement.

Replacement

Gets the font a font not found is drawn in, and after a comma the big font a big font not found is drawn in; empty for the canvas's own.

Substitutions

Gets the fonts drawn in others, each name to the name it is drawn in, in the order of their names.

Methods

IsBuiltIn(string)

Gets whether a font's name is that of the presenter's own font, as a text style, FONTALT or a font typed names it: opencad2d or opencad2d.shx, letters of either case the same, the spaces around it left out; no file on disk is looked for.

IsSetAs(CadFonts)

Gets whether these fonts are set as another's: the same folders, replacement and substitutions.

Load(string)

Reads the SHX font of a file, once for every document while its file is unchanged; null, said once at Debug, where it cannot be read or is no SHX font.

Locate(string, string)

Finds a font's file: the path as written where it is a full path that is there, else its file name in Folders and then the Fonts folder beside the dll, .shx added to a name of no extension (txt is txt.shx); a TrueType file (.ttf, .ttc, .otf) last in the Fonts folder of Windows, as the system's fonts.

ReadFontMap(string)

Reads a font mapping file as AutoCAD's FONTMAP reads acad.fmp: a line oldfont;newfont for each font drawn in another (romans.shx;isocp.shx), blank lines and lines of no semicolon or a blank half passed over, in the order of the file. A file that is not there or cannot be read gives none, said once at Debug; nothing throws.

WithSubstitution(string, string)

Gets these fonts with one more font drawn in another, as a font missing is given its own replacement: the same folders and replacement, the name added to Substitutions or its font changed.