• PUDN用户
    了解作者
  • C++
    开发工具
  • 16KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1663
    下载次数
  • 2006-09-17 18:36
    上传日期
Windows TTF字体格式结构及读取源程序,通过简单修改就可以用在自己的程序中。
TTF.rar
  • TTF.DOC
    67KB
  • TTF.TXT
    16.5KB
  • www.pudn.com.txt
    218B
内容介绍
//Ttf.h class TtfTable; class GdcTtf; class LgiClass GdcFontMetrics { public: long tmHeight; long tmAscent; long tmDescent; long tmInternalLeading; long tmExternalLeading; long tmAveCharWidth; long tmMaxCharWidth; long tmWeight; long tmOverhang; long tmDigitizedAspectX; long tmDigitizedAspectY; char tmFirstChar; char tmLastChar; char tmDefaultChar; char tmBreakChar; char tmItalic; char tmUnderlined; char tmStruckOut; char tmPitchAndFamily; char tmCharSet; }; class LgiClass GTypeFace { protected: uint Flags; // FNT_xxx flags uint Height; uint Width; uint Escapement; uint Orientation; uint Weight; uchar CharSet; uchar OutPrecision; uchar ClipPrecision; uchar Quality; uchar PitchAndFamily; char FaceName[33]; // Output COLOUR ForeCol; COLOUR BackCol; bool Trans; int TabSize; public: GTypeFace() { ForeCol = 0; BackCol = 0xFFFFFF; Trans = FALSE; TabSize = 0; } virtual ~GTypeFace() {} virtual void Colour(COLOUR Fore, COLOUR Back = 0xFFFFFFFF) { ForeCol = Fore; BackCol = Back; } void Fore(COLOUR f) { ForeCol = f; } COLOUR Fore() { return ForeCol; } void Back(COLOUR b) { BackCol = b; } COLOUR Back() { return BackCol; } void Transparent(bool t) { Trans = t; } void SetTabs(int tabsize) { TabSize = tabsize; } virtual bool Load(GFile &F) { return FALSE; } virtual bool Save(GFile &F) { return FALSE; } }; typedef unsigned long TTF_FIXED; typedef signed short TTF_FWORD; typedef unsigned short TTF_UFWORD; typedef signed short TTF_F2DOT14; class LgiClass TtfFileHeader { public: TTF_FIXED Version; // 0x00010000 for version 1.0. ushort NumTables; // Number of tables. ushort SearchRange; // (Maximum power of 2 �� numTables) x 16. ushort EntrySelector; // Log2(maximum power of 2 �� numTables). ushort RangeShift; // NumTables x 16-searchRange. bool Read(GFile &F); bool Write(GFile &F); void Dump(); }; class LgiClass TtfTable { public: char Tag[4]; // 4-byte identifier. ulong CheckSum; // CheckSum for this table. ulong Offset; // Offset from beginning of TrueType font file. ulong Length; // Length of this table. void *Table; virtual bool Read(GFile &F); virtual bool Write(GFile &F); virtual void Dump(); }; class LgiClass TtfObj { public: GdcTtf *Parent; TtfObj() { Parent = 0; } void *FindTag(char *t); }; class LgiClass TtfHeader : public TtfObj { public: ulong Version; // 0x00010000 for version 1.0. ulong Revision; // Set by font manufacturer. ulong CheckSumAdjustment; // To compute: set it to 0, sum the entire font as ULONG, then store 0xB1B0AFBA - sum. ulong MagicNumber; // Set to 0x5F0F3CF5. ushort Flags; // 0x0001 - baseline for font at y=0 // 0x0002 - left sidebearing at x=0 // 0x0004 - instructions may depend on point size // 0x0008 - force ppem to integer values for all internal scaler math, may use fractional ppem sizes if this bit is clear // 0x0010 - instructions may alter advance width (the advance widths might not scale linearly) // Note: All other bits must be zero. ushort UnitsPerEm; // Valid range is from 16 to 16384 quad InternationalDate; // (8-byte field). quad Modified; // International date (8-byte field). TTF_FWORD xMin; // For all glyph bounding boxes. TTF_FWORD yMin; // For all glyph bounding boxes. TTF_FWORD xMax; // For all glyph bounding boxes. TTF_FWORD yMax; // For all glyph bounding boxes. ushort MacStyle; // 0x0001 - bold (if set to 1) // 0x0002 - italic (if set to 1) // Bits 2-15 reserved (set to 0). ushort LowestRecPPEM; // Smallest readable size in pixels. short FontDirectionHint; // 0 Fully mixed directional glyphs // 1 Only strongly left to right // 2 Like 1 but also contains neutrals // -1 Only strongly right to left // -2 Like -1 but also contains neutrals. short IndexToLocFormat; // 0 for short offsets // 1 for long. short GlyphDataFormat; // 0 for current format. bool Read(GFile &F); bool Write(GFile &F); void Dump(); }; class LgiClass TtfMaxProfile : public TtfObj { public: ulong Version; // 0x00010000 for version 1.0. ushort NumGlyphs; // The number of glyphs in the font. ushort MaxPoints; // Maximum points in a non-composite glyph. ushort MaxContours; // Maximum contours in a non-composite glyph. ushort MaxCompositePoints; // Maximum points in a composite glyph. ushort MaxCompositeContours; // Maximum contours in a composite glyph. ushort MaxZones; // 1 if instructions do not use the twilight zone (Z0), or 2 if instructions do use Z0; should be set to 2 in most cases. ushort MaxTwilightPoints; // Maximum points used in Z0. ushort MaxStorage; // Number of Storage Area locations. ushort MaxFunctionDefs; // Number of FDEFs. ushort MaxInstructionDefs; // Number of IDEFs. ushort MaxStackElements; // Maximum stack depth . ushort MaxSizeOfInstructions; // Maximum byte count for glyph instructions. ushort MaxComponentElements; // Maximum number of components referenced at "top level" for any composite glyph. ushort MaxComponentDepth; // Maximum levels of recursion; 1 for simple components. bool Read(GFile &F); bool Write(GFile &F); void Dump(); }; class LgiClass TtfLocation : public TtfObj { int Entries; int Type; void *Data; public: TtfLocation(); virtual ~TtfLocation(); int operator [](int i); bool Read(GFile &F); bool Write(GFile &F); void Dump(); }; class LgiClass DataList { int Alloc; public: int Size; double *Data; DataList() { Size = 0; Alloc = 0; Data = 0; } virtual ~DataList() { DeleteArray(Data); } void AddValue(double n) { if (Size >= Alloc) { int NewAlloc = (Size + 16) & (~0xF); double *Temp = NEW(double[NewAlloc]); if (Temp) { memcpy(Temp, Data, sizeof(double)*Size); DeleteArray(Data); Data = Temp; Alloc = NewAlloc; } else { return; } } if (Size > 0) { for (int i=0; i<Size; i++) { if (Data[i] > n) { memmove(Data + i + 1, Data + i, sizeof(double)*(Size-i)); Data[i] = n; Size++; return; }
评论
    相关推荐
    • SDL_ttf-2.0.8.tar.gz
      linux下的一个图形开发环境 料的详细功能、包含内容说明(至少
    • SDL_ttf-2.0.9.rar
      SDL-ttf 2.0.9 TTF 繪製程序源碼
    • ttf2bdf-howto.rar
      linux并不仅仅只有一个fontforge,还有别的字库编辑开源程序,还有ttf2bdf
    • font.zip
      可以下载谷歌字体,格式为woff,woff2,ttf,eot
    • android font
      介绍一些android的font的使用,提供源码包
    • sass-font-face
      │ ├── filename.ttf │ └── filename.svg 使用mixin 将mixin文件添加到所有罗盘导入下方以及任何其他样式的上方。 @include font-face($style-name, $file, $family, $category) $sty
    • icon_font_generator-master.zip
      将所有* .svg图标从dir转换为icon-font(.ttf),并生成与flutter兼容的dart类。 NodeJs包的抽象层icon-font-generator 要求 Node.JS v11 + 安装: $ pub global activate icon_font_generator 参数: * - 必需...
    • fonttools-intro:FontTools和字体开发简介
      FontTools简介 这篇文章更全面地介绍了FontTools和现代字体开发。 它是从初学者/中级字体设计师和开发人员(即Stephen Nixon / )的角度编写的,旨在为希望更好地了解字体开发的某些常见过程和工具的设计师或开发...
    • Viktorie Full.rar
      viktorie full font for windows
    • 2dFDTD.rar
      二维fdtd程序,pml吸收边界条件,tm波入射