LibreOffice Module vcl (master)  1
ttcr.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
25 #ifndef INCLUDED_VCL_SOURCE_FONTSUBSET_TTCR_HXX
26 #define INCLUDED_VCL_SOURCE_FONTSUBSET_TTCR_HXX
27 
28 #include <sft.hxx>
29 
30 namespace vcl
31 {
32  struct TrueTypeCreator;
33 
34 /* TrueType data types */
35  typedef struct {
36  sal_uInt16 aw;
37  sal_Int16 lsb;
39 
40 /* A generic base class for all TrueType tables */
41  struct TrueTypeTable {
42  sal_uInt32 tag; /* table tag */
43  sal_uInt8 *rawdata; /* raw data allocated by GetRawData_*() */
44  void *data; /* table specific data */
45  };
46 
48  enum TTCRErrCodes {
55  };
56 
61  void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this);
62 
66  void AddTable(TrueTypeCreator *_this, TrueTypeTable *table);
67 
75  void RemoveTable(TrueTypeCreator *_this, sal_uInt32 tag);
76 
83  SFErrCodes StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length);
84 
89  SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname);
90 
100  int GetRawData(TrueTypeTable *, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag);
101 
110  TrueTypeTable *TrueTypeTableNew(sal_uInt32 tag,
111  sal_uInt32 nbytes,
112  const sal_uInt8* ptr);
113 
120  TrueTypeTable *TrueTypeTableNew_head(sal_uInt32 fontRevision,
121  sal_uInt16 flags,
122  sal_uInt16 unitsPerEm,
123  const sal_uInt8 *created,
124  sal_uInt16 macStyle,
125  sal_uInt16 lowestRecPPEM,
126  sal_Int16 fontDirectionHint);
127 
132  TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender,
133  sal_Int16 descender,
134  sal_Int16 linegap,
135  sal_Int16 caretSlopeRise,
136  sal_Int16 caretSlopeRun);
137 
143  TrueTypeTable *TrueTypeTableNew_loca();
144 
151  TrueTypeTable *TrueTypeTableNew_maxp( const sal_uInt8* maxp, int size);
152 
156  TrueTypeTable *TrueTypeTableNew_glyf();
157 
161  TrueTypeTable *TrueTypeTableNew_cmap();
162 
169  TrueTypeTable *TrueTypeTableNew_name(int n, NameRecord const *nr);
170 
174  TrueTypeTable *TrueTypeTableNew_post(sal_Int32 format,
175  sal_Int32 italicAngle,
176  sal_Int16 underlinePosition,
177  sal_Int16 underlineThickness,
178  sal_uInt32 isFixedPitch);
179 
180 // Table manipulation functions
181 
185  void cmapAdd(TrueTypeTable *, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g);
186 
195  sal_uInt32 glyfAdd(TrueTypeTable *, GlyphData *glyphdata, TrueTypeFont *fnt);
196 
201  sal_uInt32 glyfCount(const TrueTypeTable *);
202 
203 } // namespace
204 
205 extern "C"
206 {
210  void TrueTypeTableDispose(void *);
211 
216 }
217 
218 #endif // INCLUDED_VCL_SOURCE_FONTSUBSET_TTCR_HXX
219 
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TrueTypeTable * TrueTypeTableNew_loca()
Creates a new empty 'loca' table for a TrueType font.
Definition: ttcr.cxx:900
'name' table is too long (string data > 64K)
Definition: ttcr.hxx:53
SFErrCodes
Return value of OpenTTFont() and CreateT3FromTTGlyphs()
Definition: sft.hxx:60
sal_uInt32 glyfAdd(TrueTypeTable *table, GlyphData *glyphdata, TrueTypeFont *fnt)
Add a glyph to a glyf table.
Definition: ttcr.cxx:1123
TrueTypeTable * TrueTypeTableNew_cmap()
Creates a new empty 'cmap' table.
Definition: ttcr.cxx:945
no error
Definition: ttcr.hxx:49
TrueTypeTable * TrueTypeTableNew_glyf()
Creates a new empty 'glyf' table.
Definition: ttcr.cxx:929
TrueTypeTable * TrueTypeTableNew(sal_uInt32 tag, sal_uInt32 nbytes, const sal_uInt8 *ptr)
Creates a new raw TrueType table.
Definition: ttcr.cxx:817
sal_uInt16 aw
Definition: ttcr.hxx:36
TrueTypeTable * TrueTypeTableNew_maxp(const sal_uInt8 *maxp, int size)
Creates a new 'maxp' table based on an existing maxp table.
Definition: ttcr.cxx:914
Unknown TrueType table.
Definition: ttcr.hxx:51
'name' table does not contain any names
Definition: ttcr.hxx:52
TrueTypeTable * TrueTypeTableNew_head(sal_uInt32 fontRevision, sal_uInt16 flags, sal_uInt16 unitsPerEm, const sal_uInt8 *created, sal_uInt16 macStyle, sal_uInt16 lowestRecPPEM, sal_Int16 fontDirectionHint)
Creates a new 'head' table for a TrueType font.
Definition: ttcr.cxx:839
At least one glyph should be defined.
Definition: ttcr.hxx:50
SFErrCodes StreamToFile(TrueTypeCreator *_this, const char *fname)
Writes a TrueType font generated by the TrueTypeCreator to a file.
Definition: ttcr.cxx:263
TrueTypeTable * TrueTypeTableNew_hhea(sal_Int16 ascender, sal_Int16 descender, sal_Int16 linegap, sal_Int16 caretSlopeRise, sal_Int16 caretSlopeRun)
Creates a new 'hhea' table for a TrueType font.
Definition: ttcr.cxx:871
TrueTypeTable * TrueTypeTableNew_post(sal_Int32 format, sal_Int32 italicAngle, sal_Int16 underlinePosition, sal_Int16 underlineThickness, sal_uInt32 isFixedPitch)
Creates a new 'post' table of one of the supported formats.
Definition: ttcr.cxx:1008
sal_uInt32 tag
Definition: ttcr.cxx:465
void RemoveTable(TrueTypeCreator *_this, sal_uInt32 tag)
Removes a TrueType table from the TrueType creator if it is stored there.
Definition: ttcr.cxx:160
void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this)
TrueTypeCreator constructor.
Definition: ttcr.cxx:141
int GetRawData(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag)
This function converts the data of a TrueType table to a raw array of bytes.
Definition: ttcr.cxx:1032
SFErrCodes StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length)
Writes a TrueType font generated by the TrueTypeCreator to a segment of memory that this method alloc...
Definition: ttcr.cxx:184
unsigned char sal_uInt8
unsupported format of a 'post' table
Definition: ttcr.hxx:54
sal_uInt8 * rawdata
Definition: ttcr.hxx:43
Sun Font Tools.
void cmapAdd(TrueTypeTable *table, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g)
Add a character/glyph pair to a cmap table.
Definition: ttcr.cxx:1057
void TrueTypeTableDispose(void *)
Destructor for the TrueTypeTable object.
Definition: ttcr.cxx:1425
void AddTable(TrueTypeCreator *_this, TrueTypeTable *table)
Adds a TrueType table to the TrueType creator.
Definition: ttcr.cxx:153
TrueTypeTable * TrueTypeTableNew_name(int n, NameRecord const *nr)
Creates a new 'name' table.
Definition: ttcr.cxx:985
sal_uInt32 glyfCount(const TrueTypeTable *table)
Query the number of glyphs currently stored in the 'glyf' table.
Definition: ttcr.cxx:1177
TTCRErrCodes
Error codes for most functions.
Definition: ttcr.hxx:48
sal_Int16 lsb
Definition: ttcr.hxx:37
sal_uInt32 tag
Definition: ttcr.hxx:42
void TrueTypeCreatorDispose(vcl::TrueTypeCreator *_this)
TrueTypeCreator destructor.
Definition: ttcr.cxx:1416