LibreOffice Module vcl (master)
1
|
Functions | |
int | vcl::CountTTCFonts (const char *fname) |
Get the number of fonts contained in a TrueType collection. More... | |
SFErrCodes | vcl::OpenTTFontBuffer (const void *pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont **ttf, const FontCharMapRef xCharMap=nullptr) |
TrueTypeFont constructor. More... | |
SFErrCodes | vcl::OpenTTFontFile (const char *fname, sal_uInt32 facenum, TrueTypeFont **ttf, const FontCharMapRef xCharMap=nullptr) |
TrueTypeFont constructor. More... | |
void | vcl::CloseTTFont (TrueTypeFont *) |
TrueTypeFont destructor. More... | |
int | vcl::GetTTGlyphPoints (AbstractTrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray) |
Extracts TrueType control points, and stores them in an allocated array pointed to by *pointArray. More... | |
GlyphData * | vcl::GetTTRawGlyphData (AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) |
Extracts raw glyph data from the 'glyf' table and returns it in an allocated GlyphData structure. More... | |
int | vcl::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. More... | |
int | vcl::GetTTNameRecords (AbstractTrueTypeFont const *ttf, NameRecord **nr) |
Extracts all Name Records from the font and stores them in an allocated array of NameRecord structs. More... | |
void | vcl::DisposeNameRecords (NameRecord *nr, int n) |
Deallocates previously allocated array of NameRecords. More... | |
SFErrCodes | vcl::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. More... | |
SFErrCodes | vcl::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. More... | |
SFErrCodes | vcl::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. More... | |
std::unique_ptr< sal_uInt16[]> | vcl::GetTTSimpleGlyphMetrics (AbstractTrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical) |
Queries glyph metrics. More... | |
void | vcl::GetTTGlobalFontInfo (TrueTypeFont *ttf, TTGlobalFontInfo *info) |
Returns global font information about the TrueType font. More... | |
bool | vcl::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. More... | |
void | vcl::GetTTFontMetrics (const uint8_t *pHhea, size_t nHhea, const uint8_t *pOs2, size_t nOs2, TTGlobalFontInfo *info) |
Returns fonts metrics. More... | |
void VCL_DLLPUBLIC vcl::CloseTTFont | ( | TrueTypeFont * | ) |
TrueTypeFont destructor.
Deallocates the memory.
Definition at line 1238 of file sft.cxx.
Referenced by EmbeddedFontsHelper::sufficientTTFRights(), and TestFontSubset().
int vcl::CountTTCFonts | ( | const char * | fname | ) |
Get the number of fonts contained in a TrueType collection.
fname | - file name |
Definition at line 1089 of file sft.cxx.
References FILE, vcl::GetUInt32(), and vcl::T_ttcf.
SFErrCodes vcl::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.
This function substitutes glyph 0 for all glyphIDs that are not found in the font.
ttf | pointer to the TrueTypeFont structure |
outf | the resulting font is written to this stream |
fname | font name for the new font. If it is NULL the PostScript name of the original font will be used |
glyphArray | pointer to an array of glyphs that are to be extracted from ttf |
encoding | array of encoding values. encoding[i] specifies the position of the glyph glyphArray[i] in the encoding vector of the resulting Type3 font |
nGlyphs | number of glyph IDs in glyphArray and encoding values in encoding |
wmode | writing mode for the output file: 0 - horizontal, 1 - vertical |
Definition at line 1539 of file sft.cxx.
References vcl::BadArg, vcl::BSplineToPSPath(), vcl::TrueTypeFont::fsize, vcl::GetInt16(), vcl::GetTTGlyphOutline(), vcl::GetUInt16(), vcl::AbstractTrueTypeFont::glyphCount(), vcl::GlyphNum, i, n, vcl::O_head, vcl::Ok, vcl::TrueTypeFont::psname, vcl::TrueTypeFont::ptr, table, vcl::TrueTypeFont::table(), type, vcl::AbstractTrueTypeFont::unitsPerEm(), and vcl::XUnits().
Referenced by FontSubsetInfo::CreateFontSubsetFromSfnt().
SFErrCodes vcl::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.
This function substitutes glyph 0 for all glyphIDs that are not found in the font.
ttf | pointer to the TrueTypeFont structure |
outf | output stream for a resulting font |
psname | PostScript name of the resulting font |
glyphArray | pointer to an array of glyphs that are to be extracted from ttf. The first element of this array has to be glyph 0 (default glyph) |
encoding | array of encoding values. encoding[i] specifies character code for the glyphID glyphArray[i]. Character code 0 usually points to a default glyph (glyphID 0) |
nGlyphs | number of glyph IDs in glyphArray and encoding values in encoding |
hhea
maxp
cvt
prep
fpgm
glyf
Definition at line 1964 of file sft.cxx.
References vcl::AddTable(), vcl::DumpSfnts(), vcl::TrueTypeFont::family, vcl::AbstractTrueTypeFont::fileName(), vcl::TrueTypeFont::fsize, vcl::GetInt16(), vcl::GetInt32(), vcl::GetTTRawGlyphData(), vcl::GetUInt16(), vcl::glyfAdd(), vcl::glyfCount(), vcl::GlyphNum, vcl::HEAD_created_offset, vcl::HEAD_flags_offset, vcl::HEAD_fontDirectionHint_offset, vcl::HEAD_fontRevision_offset, vcl::HEAD_lowestRecPPEM_offset, vcl::HEAD_macStyle_offset, vcl::HEAD_majorVersion_offset, vcl::HEAD_unitsPerEm_offset, vcl::HEAD_xMax_offset, vcl::HEAD_xMin_offset, vcl::HEAD_yMax_offset, vcl::HEAD_yMin_offset, vcl::HHEA_ascender_offset, vcl::HHEA_caretSlopeRise_offset, vcl::HHEA_caretSlopeRun_offset, vcl::HHEA_descender_offset, vcl::HHEA_lineGap_offset, i, vcl::O_cvt, vcl::O_fpgm, vcl::O_head, vcl::O_hhea, vcl::O_maxp, vcl::O_prep, vcl::Ok, p, vcl::TrueTypeFont::psname, vcl::TrueTypeFont::ptr, vcl::scalloc(), vcl::StreamToMemory(), vcl::TrueTypeFont::subfamily, vcl::T_cvt, vcl::T_fpgm, vcl::T_prep, vcl::T_true, vcl::TrueTypeFont::table(), TrueTypeCreatorDispose(), vcl::TrueTypeCreatorNewEmpty(), vcl::TrueTypeTableNew(), vcl::TrueTypeTableNew_glyf(), vcl::TrueTypeTableNew_head(), vcl::TrueTypeTableNew_hhea(), vcl::TrueTypeTableNew_maxp(), vcl::AbstractTrueTypeFont::unitsPerEm(), and vcl::XUnits().
Referenced by FontSubsetInfo::CreateFontSubsetFromSfnt().
VCL_DLLPUBLIC SFErrCodes vcl::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.
This function substitutes glyph 0 for all glyphIDs that are not found in the font.
ttf | pointer to the TrueTypeFont structure |
fname | file name for the output TrueType font file |
glyphArray | pointer to an array of glyphs that are to be extracted from ttf. The first element of this array has to be glyph 0 (default glyph) |
encoding | array of encoding values. encoding[i] specifies character code for the glyphID glyphArray[i]. Character code 0 usually points to a default glyph (glyphID 0) |
nGlyphs | number of glyph IDs in glyphArray and encoding values in encoding |
flags | or'ed TTCreationFlags |
name
maxp
hhea
head
glyf
cmap
cvt
prep
fpgm
post
Definition at line 1692 of file sft.cxx.
References vcl::AddTable(), vcl::cmapAdd(), vcl::DisposeNameRecords(), vcl::GetInt16(), vcl::GetInt32(), vcl::GetTTNameRecords(), vcl::GetTTRawGlyphData(), vcl::GetUInt16(), vcl::GetUInt32(), vcl::glyfAdd(), vcl::HEAD_created_offset, vcl::HEAD_flags_offset, vcl::HEAD_fontDirectionHint_offset, vcl::HEAD_fontRevision_offset, vcl::HEAD_lowestRecPPEM_offset, vcl::HEAD_macStyle_offset, vcl::HEAD_unitsPerEm_offset, vcl::HHEA_ascender_offset, vcl::HHEA_caretSlopeRise_offset, vcl::HHEA_caretSlopeRun_offset, vcl::HHEA_descender_offset, vcl::HHEA_lineGap_offset, i, n, name, vcl::O_cvt, vcl::O_fpgm, vcl::O_head, vcl::O_hhea, vcl::O_maxp, vcl::O_post, vcl::O_prep, vcl::Ok, p, vcl::POST_isFixedPitch_offset, vcl::POST_italicAngle_offset, vcl::POST_underlinePosition_offset, vcl::POST_underlineThickness_offset, SAL_WARN_IF, vcl::scalloc(), vcl::StreamToFile(), vcl::T_cvt, vcl::T_fpgm, vcl::T_prep, vcl::T_true, vcl::AbstractTrueTypeFont::table(), TrueTypeCreatorDispose(), vcl::TrueTypeCreatorNewEmpty(), vcl::TrueTypeTableNew(), vcl::TrueTypeTableNew_cmap(), vcl::TrueTypeTableNew_glyf(), vcl::TrueTypeTableNew_head(), vcl::TrueTypeTableNew_hhea(), vcl::TrueTypeTableNew_maxp(), vcl::TrueTypeTableNew_name(), and vcl::TrueTypeTableNew_post().
Referenced by SalGraphics::CreateTTFfontSubset(), and TestFontSubset().
void vcl::DisposeNameRecords | ( | NameRecord * | nr, |
int | n | ||
) |
Deallocates previously allocated array of NameRecords.
nr | array of NameRecord structs |
n | number of elements in the array |
Definition at line 2389 of file sft.cxx.
References i.
Referenced by vcl::CreateTTFromTTGlyphs().
void vcl::GetTTFontMetrics | ( | const uint8_t * | pHhea, |
size_t | nHhea, | ||
const uint8_t * | pOs2, | ||
size_t | nOs2, | ||
TTGlobalFontInfo * | info | ||
) |
Returns fonts metrics.
hhea | hhea table data |
os2 | OS/2 table data |
info | pointer to a TTGlobalFontInfo structure |
Definition at line 2119 of file sft.cxx.
References vcl::TTGlobalFontInfo_::ascender, vcl::TTGlobalFontInfo_::descender, vcl::TTGlobalFontInfo_::fsSelection, vcl::GetInt16(), vcl::GetUInt16(), vcl::HHEA_ascender_offset, vcl::HHEA_descender_offset, vcl::HHEA_lineGap_offset, vcl::TTGlobalFontInfo_::linegap, vcl::OS2_fsSelection_offset, vcl::OS2_typoAscender_offset, vcl::OS2_typoDescender_offset, vcl::OS2_typoLineGap_offset, vcl::OS2_V0_length, vcl::OS2_winAscent_offset, vcl::OS2_winDescent_offset, vcl::TTGlobalFontInfo_::typoAscender, vcl::TTGlobalFontInfo_::typoDescender, vcl::TTGlobalFontInfo_::typoLineGap, vcl::TTGlobalFontInfo_::winAscent, and vcl::TTGlobalFontInfo_::winDescent.
Referenced by ImplFontMetricData::ImplCalcLineSpacing().
VCL_DLLPUBLIC bool vcl::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.
Just implemented separate, because this info not available via Qt API.
ttf | pointer to a AbstractTrueTypeFont structure |
xMin | global glyph bounding box min X |
yMin | global glyph bounding box min Y |
xMax | global glyph bounding box max X |
yMax | global glyph bounding box max Y |
macStyle | encoded Mac style flags of the font |
Definition at line 2144 of file sft.cxx.
References vcl::GetInt16(), vcl::GetUInt16(), vcl::HEAD_macStyle_offset, vcl::HEAD_xMax_offset, vcl::HEAD_xMin_offset, vcl::HEAD_yMax_offset, vcl::HEAD_yMin_offset, vcl::O_head, table, vcl::AbstractTrueTypeFont::table(), vcl::AbstractTrueTypeFont::unitsPerEm(), and vcl::XUnits().
Referenced by vcl::GetTTGlobalFontInfo().
VCL_DLLPUBLIC void vcl::GetTTGlobalFontInfo | ( | TrueTypeFont * | ttf, |
TTGlobalFontInfo * | info | ||
) |
Returns global font information about the TrueType font.
ttf | pointer to a TrueTypeFont structure |
info | pointer to a TTGlobalFontInfo structure |
Definition at line 2162 of file sft.cxx.
References vcl::TTGlobalFontInfo_::ascender, vcl::TTGlobalFontInfo_::descender, vcl::TTGlobalFontInfo_::family, vcl::TrueTypeFont::family, vcl::AbstractTrueTypeFont::GetCharMap(), vcl::GetInt16(), vcl::GetInt32(), vcl::GetTTGlobalFontHeadInfo(), vcl::GetUInt16(), vcl::GetUInt32(), vcl::HHEA_ascender_offset, vcl::HHEA_descender_offset, vcl::HHEA_lineGap_offset, FontCharMap::isSymbolic(), vcl::TTGlobalFontInfo_::italicAngle, vcl::TTGlobalFontInfo_::linegap, vcl::TTGlobalFontInfo_::macStyle, vcl::O_hhea, vcl::O_OS2, vcl::O_post, vcl::OS2_fsType_offset, vcl::OS2_panose_offset, vcl::OS2_panoseNbBytes_offset, vcl::OS2_typoAscender_offset, vcl::OS2_typoDescender_offset, vcl::OS2_typoLineGap_offset, vcl::OS2_usWeightClass_offset, vcl::OS2_usWidthClass_offset, vcl::OS2_V0_length, vcl::OS2_winAscent_offset, vcl::OS2_winDescent_offset, vcl::TTGlobalFontInfo_::panose, vcl::TTGlobalFontInfo_::pitch, vcl::POST_isFixedPitch_offset, vcl::POST_italicAngle_offset, vcl::TTGlobalFontInfo_::psname, vcl::TrueTypeFont::psname, vcl::TTGlobalFontInfo_::subfamily, vcl::TrueTypeFont::subfamily, vcl::TTGlobalFontInfo_::symbolEncoded, table, vcl::TrueTypeFont::table(), vcl::TTGlobalFontInfo_::typeFlags, vcl::TTGlobalFontInfo_::typoAscender, vcl::TTGlobalFontInfo_::typoDescender, vcl::TTGlobalFontInfo_::typoLineGap, vcl::TTGlobalFontInfo_::ufamily, vcl::TrueTypeFont::ufamily, vcl::AbstractTrueTypeFont::unitsPerEm(), vcl::TTGlobalFontInfo_::usubfamily, vcl::TrueTypeFont::usubfamily, vcl::TTGlobalFontInfo_::weight, vcl::TTGlobalFontInfo_::width, vcl::TTGlobalFontInfo_::winAscent, vcl::TTGlobalFontInfo_::winDescent, vcl::TTGlobalFontInfo_::xMax, vcl::TTGlobalFontInfo_::xMin, vcl::XUnits(), vcl::TTGlobalFontInfo_::yMax, and vcl::TTGlobalFontInfo_::yMin.
Referenced by EmbeddedFontsHelper::sufficientTTFRights(), and TestFontSubset().
int vcl::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.
If the glyph is a single glyph it has one component glyph (which is added to the list) and the function returns 1. For a composite glyphs it returns the number of component glyphs and adds all of them to the list.
ttf | pointer to the TrueTypeFont structure |
glyphID | Glyph ID |
glyphlist | list of glyphs |
Definition at line 1462 of file sft.cxx.
References vcl::ARG_1_AND_2_ARE_WORDS, vcl::GetInt16(), vcl::GetUInt16(), vcl::AbstractTrueTypeFont::glyphCount(), vcl::AbstractTrueTypeFont::glyphOffset(), index, vcl::MORE_COMPONENTS, n, vcl::O_glyf, SAL_WARN, vcl::AbstractTrueTypeFont::table(), vcl::WE_HAVE_A_SCALE, vcl::WE_HAVE_A_TWO_BY_TWO, and vcl::WE_HAVE_AN_X_AND_Y_SCALE.
Referenced by vcl::glyfAdd().
int vcl::GetTTGlyphPoints | ( | AbstractTrueTypeFont * | ttf, |
sal_uInt32 | glyphID, | ||
ControlPoint ** | pointArray | ||
) |
Extracts TrueType control points, and stores them in an allocated array pointed to by *pointArray.
This function returns the number of extracted points.
ttf | pointer to the TrueTypeFont structure |
glyphID | Glyph ID |
pointArray | Return value - address of the pointer to the first element of the array of points allocated by the function |
Definition at line 1457 of file sft.cxx.
References vcl::GetTTGlyphOutline().
Referenced by vcl::GetTTRawGlyphData().
int vcl::GetTTNameRecords | ( | AbstractTrueTypeFont const * | ttf, |
NameRecord ** | nr | ||
) |
Extracts all Name Records from the font and stores them in an allocated array of NameRecord structs.
ttf | pointer to the TrueTypeFont struct |
nr | pointer to the array of NameRecord structs |
Definition at line 2306 of file sft.cxx.
References vcl::NameRecord::encodingID, vcl::AbstractTrueTypeFont::fileName(), vcl::GetUInt16(), i, vcl::NameRecord::languageID, n, vcl::NameRecord::nameID, vcl::O_name, vcl::NameRecord::platformID, SAL_WARN, vcl::NameRecord::slen, vcl::NameRecord::sptr, table, and vcl::AbstractTrueTypeFont::table().
Referenced by vcl::CreateTTFromTTGlyphs().
GlyphData * vcl::GetTTRawGlyphData | ( | AbstractTrueTypeFont * | ttf, |
sal_uInt32 | glyphID | ||
) |
Extracts raw glyph data from the 'glyf' table and returns it in an allocated GlyphData structure.
ttf | pointer to the TrueTypeFont structure |
glyphID | Glyph ID |
Definition at line 2215 of file sft.cxx.
References vcl::GlyphData::aw, vcl::GlyphData::compflag, d, vcl::GetInt16(), vcl::GetTTGlyphPoints(), vcl::GetUInt16(), vcl::AbstractTrueTypeFont::glyphCount(), vcl::GlyphData::glyphID, vcl::AbstractTrueTypeFont::glyphOffset(), vcl::AbstractTrueTypeFont::horzMetricCount(), i, length, vcl::GlyphData::lsb, m, n, vcl::GlyphData::nbytes, vcl::GlyphData::ncontours, vcl::GlyphData::npoints, vcl::O_glyf, vcl::O_hmtx, vcl::GlyphData::ptr, SAL_WARN, and vcl::AbstractTrueTypeFont::table().
Referenced by vcl::CreateT42FromTTGlyphs(), vcl::CreateTTFromTTGlyphs(), and vcl::glyfAdd().
VCL_DLLPUBLIC std::unique_ptr< sal_uInt16[]> vcl::GetTTSimpleGlyphMetrics | ( | AbstractTrueTypeFont const * | ttf, |
const sal_uInt16 * | glyphArray, | ||
int | nGlyphs, | ||
bool | vertical | ||
) |
Queries glyph metrics.
Allocates an array of advance width/height values and returns it.
ttf | pointer to the TrueTypeFont structure |
glyphArray | pointer to an array of glyphs that are to be extracted from ttf |
nGlyphs | number of glyph IDs in glyphArray and encoding values in encoding |
vertical | writing mode: false - horizontal, true - vertical |
Definition at line 2075 of file sft.cxx.
References vcl::GetUInt16(), vcl::AbstractTrueTypeFont::horzMetricCount(), i, n, vcl::O_hmtx, vcl::O_vmtx, vcl::AbstractTrueTypeFont::table(), vcl::AbstractTrueTypeFont::unitsPerEm(), vcl::AbstractTrueTypeFont::vertMetricCount(), and vcl::XUnits().
Referenced by SalGraphics::CreateTTFfontSubset(), and SalGraphics::GetGlyphWidths().
SFErrCodes VCL_DLLPUBLIC vcl::OpenTTFontBuffer | ( | const void * | pBuffer, |
sal_uInt32 | nLen, | ||
sal_uInt32 | facenum, | ||
TrueTypeFont ** | ttf, | ||
const FontCharMapRef | xCharMap = nullptr |
||
) |
TrueTypeFont constructor.
The font file has to be provided as a memory buffer and length
pBuffer | - memory buffer |
nLen | - size of memory buffer |
facenum | - logical font number within a TTC file. This value is ignored for TrueType fonts |
ttf | - returns the opened TrueTypeFont |
xCharMap | - optional parsed character map |
Definition at line 1165 of file sft.cxx.
References vcl::Memory, and vcl::Ok.
Referenced by EmbeddedFontsHelper::sufficientTTFRights(), and TestFontSubset().
SFErrCodes VCL_DLLPUBLIC vcl::OpenTTFontFile | ( | const char * | fname, |
sal_uInt32 | facenum, | ||
TrueTypeFont ** | ttf, | ||
const FontCharMapRef | xCharMap = nullptr |
||
) |
TrueTypeFont constructor.
Reads the font file and allocates the memory for the structure. on WIN32 the font has to be provided as a memory buffer and length
fname | - name of TrueType font file |
facenum | - logical font number within a TTC file. This value is ignored for TrueType fonts |
ttf | - returns the opened TrueTypeFont |
xCharMap | - optional parsed character map |
Definition at line 1105 of file sft.cxx.
References vcl::BadFile, cleanup(), close, vcl::FileIo, vcl::Memory, and vcl::Ok.