Copyright 2010, SIL International All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should also have received a copy of the GNU Lesser General Public License along with this library in the file named "LICENSE". If not, write to the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA or visit their web page on the internet at http://www.fsf.org/licenses/lgpl.html.
Alternatively, the contents of this file may be used under the terms of the Mozilla Public License (http://mozilla.org/MPL) or the GNU General Public License, as published by the Free Software Foundation, either version 2 of the License or (at your option) any later version.
*/ #pragma once /*--------------------------------------------------------------------*//*:Ignore this sentence.
File: TtfUtil.h
Responsibility: Alan Ward
Last reviewed: Not yet.
Description:
Utility classfor handling TrueType font files.
----------------------------------------------------------------------------------------------*/
#include <cstddef>
namespace graphite2
{ namespace TtfUtil
{
#define OVERFLOW_OFFSET_CHECK(p, o) (o + reinterpret_cast<size_t>(p) < reinterpret_cast<size_t>(p))
// Enumeration used to specify a table in a TTF file class Tag
{ unsignedint _v; public:
Tag(constchar n[5]) throw() : _v(TTF_TAG(n[0],n[1],n[2],n[3])) {}
Tag(constunsignedint tag) throw() : _v(tag) {}
////////////////////////////////// utility methods helpful for name table bool GetNameInfo(constvoid * pName, int nPlatformId, int nEncodingId, int nLangId, int nNameId, size_t & lOffset, size_t & lSize); //size_t NameTableLength(const byte * pTable); #ifdef ALL_TTFUTILS int GetLangsForNames(constvoid * pName, int nPlatformId, int nEncodingId, int *nameIdList, int cNameIds, short *langIdList); void SwapWString(void * pWStr, size_t nSize = 0); // throw (std::invalid_argument); #endif
////////////////////////////////// primitves for simple glyph data bool GlyfBox(constvoid * pSimpleGlyf, int & xMin, int & yMin, int & xMax, int & yMax);
#ifdef ALL_TTFUTILS int GlyfContourCount(constvoid * pSimpleGlyf); bool GlyfContourEndPoints(constvoid * pSimpleGlyf, int * prgnContourEndPoint, int cnPointsTotal, size_t & cnPoints); bool GlyfPoints(constvoid * pSimpleGlyf, int * prgnX, int * prgnY, char * prgbFlag, int cnPointsTotal, int & cnPoints);
// primitive to find the glyph ids in a composite glyph bool GetComponentGlyphIds(constvoid * pSimpleGlyf, int * prgnCompId,
size_t cnCompIdTotal, size_t & cnCompId); // primitive to find the placement data for a component in a composite glyph bool GetComponentPlacement(constvoid * pSimpleGlyf, int nCompId, bool fOffset, int & a, int & b); // primitive to find the transform data for a component in a composite glyph bool GetComponentTransform(constvoid * pSimpleGlyf, int nCompId, float & flt11, float & flt12, float & flt21, float & flt22, bool & fTransOffset); #endif
////////////////////////////////// operate on composite or simple glyph (auto glyf lookup) void * GlyfLookup(gid16 nGlyphId, constvoid * pGlyf, constvoid * pLoca,
size_t lGlyfSize, size_t lLocaSize, constvoid * pHead); // primitive used by below methods
#ifdef ALL_TTFUTILS // below are primary user methods for handling glyf data bool IsSpace(gid16 nGlyphId, constvoid * pLoca, size_t lLocaSize, constvoid * pHead); bool IsDeepComposite(gid16 nGlyphId, constvoid * pGlyf, constvoid * pLoca,
size_t lGlyfSize, size_t lLocaSize, constvoid * pHead);
// utitily method used by high-level GlyfPoints bool SimplifyFlags(char * prgbFlags, int cnPoints); bool CalcAbsolutePoints(int * prgnX, int * prgnY, int cnPoints); #endif
} // end of namespace TtfUtil
} // end of namespace graphite2
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.