newbie looking for fonts

Andreas Raab squeak-dev at lists.squeakfoundation.org
Mon Oct 28 10:26:19 UTC 2002


> Andreas, could you explain the non-obvious functions
> a bit?

char *ioListFont(int fontIndex);
* Returns the name for the font with index "fontIndex" 
  (this assumes there's a way of enumerating the font names uniquely)

int ioCreateFont(int fontNameIndex, int fontNameLength, int pixelSize,
int flags);
* Creates a font instance and return an "int" handle
  - fontNameIndex/Length: The font name
  - pixelSize: The requested size in pixels (not points)
  - flags: encoding bold/italic/underline/struckout

int ioDestroyFont(int fontIndex);
* Destroys the font with the given font handle

int ioFontWidthOfChar(int fontIndex, int characterIndex);
* Returns the width (in pixels) of one character in a font
  - fontIndex: the handle to the font
  - charIndex: the index of the character

int ioFontFullWidthOfChar(int fontIndex, int characterIndex, int
width[3]);
* Returns the width of a character describing:
  - width[0]: The advance width before the glyph is drawn
    (may be negative -> underhang)
  - width[1]: The glyph width
  - width[2]: The advance width after the glyph is drawn
    (may be negative -> overhang)

int ioFontNumKernPairs(int fontIndex);
* Returns the number of kerning pairs for this font

int ioFontGetKernPair(int fontIndex, int kernIndex, int kernPair[3]);
* Returns a kerninpair:
  - kernPair[0]: Left character
  - kernPair[1]: Right charater
  - kernPair[2]: kerning value

int ioFontGlyphOfChar(int fontIndex, int characterIndex, 
                     int formBitsIndex, int formWidth, int formHeight,
int formDepth);
* Returns the form for the given character

int ioFontEncoding(int fontIndex);
* Returns the encoding for this font:
  - 0: Mac Roman
  - 1: ISO-Latin

int ioFontAscent(int fontIndex);
* Returns the ascent of the font

int ioFontDescent(int fontIndex);
* Returns the descent of the font

int ioFontEmbeddingFlags(int fontIndex);
* Returns the "font embedding" flags as defined by the TrueType
specification
  (the embedding flags describe if and how fonts may be redistributed
with documents)

int ioGetFontDataSize(int fontIndex);
* Returns the size needed for embedding font data

int ioGetFontData(int fontIndex, char *buffer, int bufSize);
* Returns the data for font embedding

Cheers,
  - Andreas




More information about the Squeak-dev mailing list