40#ifndef INCLUDED_VCL_INC_SFT_HXX
41#define INCLUDED_VCL_INC_SFT_HXX
443constexpr sal_uInt32
T_OS2 = 0x4F532F32;
445constexpr sal_uInt32
T_cvt = 0x63767420;
449constexpr sal_uInt32
T_CFF = 0x43464620;
498 std::optional<std::bitset<UnicodeCoverage::MAX_UC_ENUM>> & rUnicodeCoverage,
499 std::optional<std::bitset<CodePageCoverage::MAX_CP_ENUM>> & rCodePageCoverage,
500 const unsigned char* pTable,
size_t nLength);
615 sal_uInt16
const *glyphArray,
642 sal_uInt16
const *glyphArray,
696 const uint8_t *pOs2,
size_t nOs2,
738 std::string
const &
fileName()
const {
return m_sFileName; }
740 sal_uInt32 glyphOffset(sal_uInt32 glyphID)
const;
778 inline const sal_uInt8*
table(sal_uInt32 ord, sal_uInt32& size)
const override;
virtual bool hasTable(sal_uInt32 ord) const =0
sal_uInt32 m_nHorzMetrics
sal_uInt32 vertMetricCount() const
std::string const & fileName() const
sal_uInt32 horzMetricCount() const
sal_uInt32 m_nVertMetrics
const FontCharMapRef & GetCharMap() const
virtual const sal_uInt8 * table(sal_uInt32 ord, sal_uInt32 &size) const =0
sal_uInt32 glyphCount() const
FontCharMapRef m_xCharMap
std::vector< sal_uInt32 > m_aGlyphOffsets
sal_uInt32 unitsPerEm() const
const sal_uInt8 * table(sal_uInt32 ord, sal_uInt32 &size) const override
bool hasTable(sal_uInt32 ord) const override
TrueTypeFont(const char *pFileName=nullptr, const FontCharMapRef xCharMap=nullptr)
SFErrCodes open(sal_uInt32 facenum)
std::array< struct TTFontTable_, NUM_TAGS > m_aTableList
SFErrCodes OpenTTFontBuffer(const void *pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont **ttf, const FontCharMapRef xCharMap)
TrueTypeFont constructor.
std::unique_ptr< sal_uInt16[]> GetTTSimpleGlyphMetrics(AbstractTrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical)
Queries glyph metrics.
GlyphData * GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID)
Extracts raw glyph data from the 'glyf' table and returns it in an allocated GlyphData structure.
int CountTTCFonts(const char *fname)
Get the number of fonts contained in a TrueType collection.
int GetTTNameRecords(AbstractTrueTypeFont const *ttf, NameRecord **nr)
Extracts all Name Records from the font and stores them in an allocated array of NameRecord structs.
void DisposeNameRecords(NameRecord *nr, int n)
Deallocates previously allocated array of NameRecords.
int GetTTGlyphPoints(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray)
Extracts TrueType control points, and stores them in an allocated array pointed to by *pointArray.
SFErrCodes CreateTTFromTTGlyphs(AbstractTrueTypeFont *ttf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, int nGlyphs)
Generates a new TrueType font and dumps it to outf file.
bool GetTTGlobalFontHeadInfo(const AbstractTrueTypeFont *ttf, int &xMin, int &yMin, int &xMax, int &yMax, sal_uInt16 &macStyle)
Returns part of the head table info, normally collected by GetTTGlobalFontInfo.
int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, std::vector< sal_uInt32 > &glyphlist)
For a specified glyph adds all component glyphs IDs to the list and return their number.
void CloseTTFont(TrueTypeFont *ttf)
TrueTypeFont destructor.
SFErrCodes CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode)
Generates a new PostScript Type 3 font and dumps it to outf file.
SFErrCodes CreateT42FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *psname, sal_uInt16 const *glyphArray, sal_uInt8 *encoding, int nGlyphs)
Generates a new PostScript Type42 font and dumps it to outf file.
void GetTTFontMetrics(const uint8_t *pHhea, size_t nHhea, const uint8_t *pOs2, size_t nOs2, TTGlobalFontInfo *info)
Returns fonts metrics.
void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info)
Returns global font information about the TrueType font.
SFErrCodes OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont **ttf, const FontCharMapRef xCharMap)
TrueTypeFont constructor.
constexpr int HHEA_ascender_offset
constexpr int OS2_ulCodePageRange1_offset
constexpr int HEAD_glyphDataFormat_offset
constexpr int OS2_ulUnicodeRange4_offset
constexpr int OS2_fsType_offset
constexpr sal_uInt32 T_ttcf
constexpr int HHEA_lineGap_offset
constexpr int OS2_typoDescender_offset
constexpr int HEAD_lowestRecPPEM_offset
constexpr int OS2_Legacy_length
constexpr int OS2_usWeightClass_offset
constexpr int HEAD_fontRevision_offset
constexpr sal_uInt32 T_post
constexpr sal_uInt32 T_cvt
constexpr sal_uInt32 T_vhea
constexpr sal_uInt32 T_loca
constexpr int HEAD_majorVersion_offset
constexpr int HHEA_Length
constexpr int OS2_winAscent_offset
constexpr int HEAD_yMax_offset
constexpr int HHEA_caretSlopeRise_offset
constexpr sal_uInt32 T_otto
constexpr int GLYF_xMax_offset
SFErrCodes
Return value of OpenTTFont() and CreateT3FromTTGlyphs()
@ FontNo
incorrect logical font number of a TTC font
@ TtFormat
incorrect TrueType font format
@ GlyphNum
incorrect number of glyphs
@ BadArg
incorrect arguments
constexpr int OS2_typoAscender_offset
constexpr int MAXP_maxCompositePoints_offset
constexpr int GLYF_Length
struct TTGlobalFontInfo_ TTGlobalFontInfo
Return value of GetTTGlobalFontInfo()
constexpr int OS2_typoLineGap_offset
constexpr sal_uInt32 T_true
constexpr sal_uInt32 T_prep
constexpr sal_uInt32 T_glyf
constexpr int OS2_ulUnicodeRange3_offset
constexpr int MAXP_Version1Length
constexpr int GLYF_numberOfContours_offset
constexpr int OS2_ulCodePageRange2_offset
constexpr sal_uInt32 T_hhea
constexpr int MAXP_maxCompositeContours_offset
constexpr int OS2_panoseNbBytes_offset
constexpr int MAXP_maxPoints_offset
constexpr int OS2_fsSelection_offset
constexpr int OS2_ulUnicodeRange2_offset
constexpr int HEAD_created_offset
constexpr int GLYF_yMax_offset
constexpr int HHEA_caretSlopeRun_offset
constexpr int HEAD_flags_offset
constexpr int HEAD_unitsPerEm_offset
WidthClass
Value of the width member of the TTGlobalFontInfo struct.
@ FWIDTH_CONDENSED
75% of normal
@ FWIDTH_ULTRA_CONDENSED
50% of normal
@ FWIDTH_SEMI_EXPANDED
112.5% of normal
@ FWIDTH_EXTRA_EXPANDED
150% of normal
@ FWIDTH_EXPANDED
125% of normal
@ FWIDTH_EXTRA_CONDENSED
62.5% of normal
@ FWIDTH_ULTRA_EXPANDED
200% of normal
@ FWIDTH_NORMAL
Medium, 100%
@ FWIDTH_SEMI_CONDENSED
87.5% of normal
bool getTTCoverage(std::optional< std::bitset< UnicodeCoverage::MAX_UC_ENUM > > &rUnicodeRange, std::optional< std::bitset< CodePageCoverage::MAX_CP_ENUM > > &rCodePageRange, const unsigned char *pTable, size_t nLength)
constexpr int HEAD_xMax_offset
constexpr sal_uInt32 T_head
constexpr int HEAD_yMin_offset
constexpr sal_uInt32 T_gsub
constexpr int MAXP_maxContours_offset
constexpr int HEAD_fontDirectionHint_offset
constexpr int HEAD_xMin_offset
constexpr int MAXP_numGlyphs_offset
constexpr int POST_isFixedPitch_offset
constexpr int POST_underlinePosition_offset
constexpr int GLYF_yMin_offset
constexpr int HEAD_magicNumber_offset
constexpr int OS2_V1_length
constexpr int POST_italicAngle_offset
constexpr sal_uInt32 T_maxp
constexpr sal_uInt32 T_OS2
constexpr sal_uInt32 T_CFF
constexpr int GLYF_xMin_offset
constexpr int HEAD_indexToLocFormat_offset
constexpr sal_uInt32 T_hmtx
constexpr sal_uInt32 T_name
constexpr int HEAD_macStyle_offset
constexpr sal_uInt32 T_fpgm
constexpr int POST_underlineThickness_offset
constexpr int HHEA_descender_offset
constexpr int OS2_ulUnicodeRange1_offset
constexpr int HEAD_Length
constexpr int OS2_panose_offset
constexpr sal_uInt32 T_cmap
constexpr sal_uInt32 T_vmtx
constexpr int OS2_winDescent_offset
WeightClass
Value of the weight member of the TTGlobalFontInfo struct.
@ FW_SEMIBOLD
Semi-bold (Demi-bold)
@ FW_NORMAL
Normal (Regular)
@ FW_EXTRALIGHT
Extra-light (Ultra-light)
@ FW_EXTRABOLD
Extra-bold (Ultra-bold)
constexpr int OS2_usWidthClass_offset
CompositeFlags
Composite glyph flags definition.
@ WE_HAVE_AN_X_AND_Y_SCALE
sal_Int32 F16Dot16
fixed: 16.16
constexpr int OS2_V0_length
ControlPoint structure used by GetTTGlyphPoints()
sal_Int16 y
Y coordinate in EmSquare units
sal_Int16 x
X coordinate in EmSquare units
sal_uInt32 flags
00000000 00000000 e0000000 bbbbbbbb
Structure used by the TrueType Creator and GetRawGlyphData()
sal_uInt32 glyphID
glyph ID
bool compflag
false- if non-composite
sal_uInt16 ncontours
number of contours
sal_uInt16 npoints
number of points
sal_uInt8 * ptr
pointer to glyph data
sal_uInt16 aw
advance width
sal_uInt32 newID
used internally by the TTCR
sal_uInt16 nbytes
number of bytes in glyph data
sal_Int16 lsb
left sidebearing
Structure used by the TrueType Creator and CreateTTFromTTGlyphs()
sal_uInt16 slen
String length in bytes
sal_uInt16 encodingID
Platform-specific encoding ID
LanguageType languageID
Language ID
sal_uInt16 platformID
Platform ID
sal_uInt8 * sptr
Pointer to string data (not zero-terminated!)
Return value of GetTTGlobalFontInfo()
int italicAngle
in counter-clockwise degrees * 65536
int ascender
typographic ascent.
int typoDescender
OS/2 portable typographic descender
int yMin
global bounding box: yMin
int winAscent
ascender metric for Windows
int xMin
global bounding box: xMin
int typoAscender
OS/2 portable typographic ascender
sal_uInt8 panose[10]
PANOSE classification number
int width
value of WidthClass or 0 if can't be determined
sal_Unicode * ufamily
family name UCS2
int typoLineGap
OS/2 portable typographic line gap
int weight
value of WeightClass or 0 if can't be determined
int xMax
global bounding box: xMax
sal_uInt32 typeFlags
type flags (copyright bits)
int winDescent
descender metric for Windows
char * psname
PostScript name
char * subfamily
subfamily name
int linegap
typographic line gap. Negative values are treated as zero in Win 3.1, System 6 and System 7.
int descender
typographic descent.
bool symbolEncoded
true: MS symbol encoded
int pitch
0: proportional font, otherwise: monospaced
sal_uInt16 fsSelection
OS/2 fsSelection.
sal_Unicode * usubfamily
subfamily name UCS2
sal_uInt16 macStyle
macstyle bits from 'HEAD' table
int yMax
global bounding box: yMax
Structure used by GetTTSimpleCharMetrics() functions.
sal_Int16 sb
left or top sidebearing
sal_uInt16 adv
advance width or height