Class ShxFont
- Namespace
- OpenCAD2D
- Assembly
- OpenCAD2D.Core.dll
A compiled SHX font read from the bytes of its file, of the three forms AutoCAD writes (ShxFontKind), its letters drawn by their pen codes into strokes as AutoCAD draws them: romans.shx's capitals reach Above 21 units above the baseline, so that a text 2.5 high draws them at 2.5 / 21 of a millimetre to the unit.
public sealed class ShxFont
- Inheritance
-
ShxFont
- Inherited Members
Remarks
The pen codes are those of AutoCAD's documentation of shape files, read as the library's own measuring of SHX fonts
reads them: a byte of 0x10 and over a move of its high half's length along one of 16 directions; 0 the end, 1 the pen
down, 2 up, 3 and 4 the scale divided or multiplied by the next byte, 5 and 6 the pen's place pushed and popped, 7 a
shape drawn within (its number one byte, two big-endian in a unifont, 0 hi lo in a big font, and
0 hi lo x y width height in an extended big font, drawn from a base point stretched into a box), 8 and 9 moves
by signed bytes, 10 an arc of octants (a byte of a sign and a size), 11 an arc of fractions of octants (its angles in
whole degrees), 12 and 13 arcs by their bulge (127 a half circle) and 14 the next code for vertical text alone, passed
over as text is drawn across. A letter and each shape within it start with the pen down.
A file of another form, one cut short, or a font of no height above its baseline is no font: Read(byte[]) gives null and never throws. A letter that draws shapes within itself over and over stops 16 deep, or after 100 000 codes.
Properties
- Above
Gets how far the capitals reach above the baseline in the font's units, the height of a text: 6 for txt.shx, 21 for romans.shx.
- Below
Gets how far the letters reach below the baseline in the font's units: 2 for txt.shx, 7 for romans.shx.
- Count
Gets the number of letters and shapes the font holds, shape 0 left out.
- Kind
Gets the form of the file.
Methods
- GlyphOf(int)
Gets a letter of the font drawn into its strokes, drawn once and kept; null where the font has none of that number.
- Has(int)
Gets whether the font has a letter or shape of a number: a byte in a font of shapes, a Unicode number in a unifont, two bytes in a big font.
- Opens(int)
Gets whether a byte opens a letter of two bytes in a big font, by its ranges: 0xD6 in gbcbig.shx; false in a font of another form.
- Read(byte[])
Reads a font from the bytes of a compiled SHX file; null where they are no font of the forms of ShxFontKind, are cut short, or give a font of letters no height above its baseline.