diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-01 11:54:14 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-04-01 11:54:14 +0000 |
commit | a7571a96c307b85349eaadf0d5d9c777c7881137 (patch) | |
tree | e20ef90e9197c5ea5545e968e1afc9f926f48fe3 /vcl/source/fontsubset/ttcr.hxx | |
parent | 173829f82f953ffee03558b57e6ef9036a08b9f1 (diff) |
CWS-TOOLING: integrate CWS vcl100
2009-03-26 21:27:56 +0100 pl r270106 : #i10000# fix an include path missing when using configure
2009-03-16 12:18:24 +0100 pl r269518 : #i98963# revert change
2009-03-13 14:56:47 +0100 pl r269483 : #i98980# work around a mysterious crash
2009-03-12 20:02:48 +0100 pl r269440 : resolve some warnings
2009-03-12 19:30:32 +0100 pl r269439 : resolve some warnings
2009-03-12 18:07:47 +0100 pl r269432 : solve some warnings
2009-03-12 09:07:33 +0100 hdu r269358 : #i100134# remove obsolete RCS/CVS keywords from source
2009-03-11 21:18:28 +0100 pl r269355 : #i100134# change sft.h and ttcr.h to c++ headers
2009-03-11 20:19:15 +0100 pl r269353 : #i100134# remove some ugly C style lists
2009-03-11 18:19:35 +0100 hdu r269347 : #i100134# make psprint.fontsubset source C++ and make it compile
2009-03-11 14:44:35 +0100 hdu r269334 : #i99862# fix justification of vocalized hebrew (thanks hennerdrewes)
2009-03-11 13:40:35 +0100 pl r269327 : CWS-TOOLING: rebase CWS vcl100 to trunk@269297 (milestone: DEV300:m43)
2009-03-10 16:49:34 +0100 hdu r269284 : #i1000020# add style-matching heuristics for single-char stylenames
2009-03-10 15:42:53 +0100 hdu r269278 : use fast ASCII-matching for extracting attributes from PSName
2009-03-09 16:29:08 +0100 pl r269200 : #i98980# skip bundles that are not NP plugins
2009-03-09 13:26:14 +0100 hdu r269083 : #i99868# fix text breaking for large nCharExtra
2009-03-09 12:20:01 +0100 hdu r269078 : #i99868# fix text breaking for large nCharExtra
2009-03-06 17:35:27 +0100 pl r269032 : #i98980# mouse events
2009-03-06 17:10:14 +0100 pl r269024 : #i98980# flash animations, initial paint problem
2009-03-05 20:00:21 +0100 pl r268939 : #i98980# more plugin support
2009-03-05 15:35:06 +0100 pl r268914 : #i98980# first twitches of a live plugin
2009-03-05 15:34:10 +0100 pl r268913 : #i98980# access to carbon headers
2009-03-04 15:46:29 +0100 pl r268839 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView
2009-03-04 15:40:20 +0100 pl r268838 : #i98980# generalize vcl SystemChildWindow from QTMovieView to NSView
2009-03-04 11:30:49 +0100 hdu r268801 : #i99722# for OSX any anisotropy reported for the display resolution is best ignored
2009-03-02 15:52:21 +0100 pl r268655 : #i99770# fix ambiguous looking if statements (thanks cmc)
2009-03-02 13:28:17 +0100 pl r268649 : #i99770# fix ambiguous looking if statements (thanks cmc)
2009-02-27 15:39:30 +0100 pl r268603 : #i97512# omit degenrate current matrix
2009-02-27 12:37:29 +0100 pl r268579 : #i99716# remove unused code (thanks cmc)
2009-02-27 11:21:18 +0100 pl r268569 : #i99705 remove unused code (thanks cmc)
2009-02-23 10:42:00 +0100 pl r268345 : #i99492# remove a typo (thanks tono)
2009-02-19 12:46:21 +0100 pl r268274 : #i99411# add new mimetype
2009-02-10 12:57:59 +0100 pl r267548 : #i98980# more aqua plugin changes
2009-02-06 16:50:34 +0100 pl r267475 : #i98980# plugin detection
2009-02-06 16:46:48 +0100 pl r267474 : #i98980# make debug compilation work
2009-02-06 12:16:37 +0100 pl r267449 : #98963# add missing wrapper
2009-02-04 20:06:59 +0100 pl r267402 : #i97135# work around a gcc x64 optimizer bug
2009-02-04 13:45:36 +0100 pl r267380 : #159153# do not emit empty glyph vector
2009-02-03 17:47:16 +0100 pl r267338 : #i98533# recent gtk versions do not support GTK_MODULES for accessibility anymore
2009-02-03 10:39:46 +0100 pl r267305 : #i97146# check if the idle formatted view is still valid
2009-01-28 11:23:23 +0100 pl r267045 : #i42227# #i48965# refinement of check markings images
2009-01-27 19:40:01 +0100 pl r267016 : #i42227# #i48965# change menus wrt checkmarks and images
Diffstat (limited to 'vcl/source/fontsubset/ttcr.hxx')
-rw-r--r-- | vcl/source/fontsubset/ttcr.hxx | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/vcl/source/fontsubset/ttcr.hxx b/vcl/source/fontsubset/ttcr.hxx new file mode 100644 index 000000000000..5b47f09d552a --- /dev/null +++ b/vcl/source/fontsubset/ttcr.hxx @@ -0,0 +1,261 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +/** + * + * @file ttcr.h + * @brief TrueType font creator + * @author Alexander Gelfenbain + */ + +#ifndef __TTCR_H +#define __TTCR_H + +#include "sft.hxx" + +namespace vcl +{ + typedef struct _TrueTypeCreator TrueTypeCreator; + +/* TrueType data types */ + typedef struct { + sal_uInt16 aw; + sal_Int16 lsb; + } longHorMetrics; + +/* A generic base class for all TrueType tables */ + struct TrueTypeTable { + sal_uInt32 tag; /* table tag */ + sal_uInt8 *rawdata; /* raw data allocated by GetRawData_*() */ + void *data; /* table specific data */ + }; + +/** Error codes for most functions */ + enum TTCRErrCodes { + TTCR_OK = 0, /**< no error */ + TTCR_ZEROGLYPHS = 1, /**< At least one glyph should be defined */ + TTCR_UNKNOWN = 2, /**< Unknown TrueType table */ + TTCR_GLYPHSEQ = 3, /**< Glyph IDs are not sequential in the glyf table */ + TTCR_NONAMES = 4, /**< 'name' table does not contain any names */ + TTCR_NAMETOOLONG = 5, /**< 'name' table is too long (string data > 64K) */ + TTCR_POSTFORMAT = 6 /**< unsupported format of a 'post' table */ + }; + +/* ============================================================================ + * + * TrueTypeCreator methods + * + * ============================================================================ */ + +/** + * TrueTypeCreator constructor. + * Allocates all internal structures. + */ + void TrueTypeCreatorNewEmpty(sal_uInt32 tag, TrueTypeCreator **_this); + +/** + * Adds a TrueType table to the TrueType creator. + * SF_TABLEFORMAT value. + * @return value of SFErrCodes type + */ + int AddTable(TrueTypeCreator *_this, TrueTypeTable *table); + +/** + * Removes a TrueType table from the TrueType creator if it is stored there. + * It also calls a TrueTypeTable destructor. + * Note: all generic tables (with tag 0) will be removed if this function is + * called with the second argument of 0. + * @return value of SFErrCodes type + */ + void RemoveTable(TrueTypeCreator *_this, sal_uInt32 tag); + + + +/** + * Writes a TrueType font generated by the TrueTypeCreator to a segment of + * memory that this method allocates. When it is not needed anymore the caller + * is supposed to call free() on it. + * @return value of SFErrCodes type + */ + int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length); + +/** + * Writes a TrueType font generated by the TrueTypeCreator to a file + * @return value of SFErrCodes type + */ + int StreamToFile(TrueTypeCreator *_this, const char* fname); + + +/* ============================================================================ + * + * TrueTypeTable methods + * + * ============================================================================ */ + + +/** + * This function converts the data of a TrueType table to a raw array of bytes. + * It may allocates the memory for it and returns the size of the raw data in bytes. + * If memory is allocated it does not need to be freed by the caller of this function, + * since the pointer to it is stored in the TrueTypeTable and it is freed by the destructor + * @return TTCRErrCode + * + */ + + int GetRawData(TrueTypeTable *, sal_uInt8 **ptr, sal_uInt32 *len, sal_uInt32 *tag); + +/** + * + * Creates a new raw TrueType table. The difference between this constructor and + * TrueTypeTableNew_tag constructors is that the latter create structured tables + * while this constructor just copies memory pointed to by ptr to its buffer + * and stores its length. This constructor is suitable for data that is not + * supposed to be processed in any way, just written to the resulting TTF file. + */ + TrueTypeTable *TrueTypeTableNew(sal_uInt32 tag, + sal_uInt32 nbytes, + sal_uInt8 *ptr); + +/** + * Creates a new 'head' table for a TrueType font. + * Allocates memory for it. Since a lot of values in the 'head' table depend on the + * rest of the tables in the TrueType font this table should be the last one added + * to the font. + */ + TrueTypeTable *TrueTypeTableNew_head(sal_uInt32 fontRevision, + sal_uInt16 flags, + sal_uInt16 unitsPerEm, + sal_uInt8 *created, + sal_uInt16 macStyle, + sal_uInt16 lowestRecPPEM, + sal_Int16 fontDirectionHint); + +/** + * Creates a new 'hhea' table for a TrueType font. + * Allocates memory for it and stores it in the hhea pointer. + */ + TrueTypeTable *TrueTypeTableNew_hhea(sal_Int16 ascender, + sal_Int16 descender, + sal_Int16 linegap, + sal_Int16 caretSlopeRise, + sal_Int16 caretSlopeRun); + +/** + * Creates a new empty 'loca' table for a TrueType font. + * + * INTERNAL: gets called only from ProcessTables(); + */ + TrueTypeTable *TrueTypeTableNew_loca(void); + +/** + * Creates a new 'maxp' table based on an existing maxp table. + * If maxp is 0, a new empty maxp table is created + * size specifies the size of existing maxp table for + * error-checking purposes + */ + TrueTypeTable *TrueTypeTableNew_maxp(sal_uInt8 *maxp, int size); + +/** + * Creates a new empty 'glyf' table. + */ + TrueTypeTable *TrueTypeTableNew_glyf(void); + +/** + * Creates a new empty 'cmap' table. + */ + TrueTypeTable *TrueTypeTableNew_cmap(void); + +/** + * Creates a new 'name' table. If n != 0 the table gets populated by + * the Name Records stored in the nr array. This function allocates + * memory for its own copy of NameRecords, so nr array has to + * be explicitly deallocated when it is not needed. + */ + TrueTypeTable *TrueTypeTableNew_name(int n, NameRecord *nr); + +/** + * Creates a new 'post' table of one of the supported formats + */ + TrueTypeTable *TrueTypeTableNew_post(sal_uInt32 format, + sal_uInt32 italicAngle, + sal_Int16 underlinePosition, + sal_Int16 underlineThickness, + sal_uInt32 isFixedPitch); + + +/*------------------------------------------------------------------------------ + * + * Table manipulation functions + * + *------------------------------------------------------------------------------*/ + + +/** + * Add a character/glyph pair to a cmap table + */ + void cmapAdd(TrueTypeTable *, sal_uInt32 id, sal_uInt32 c, sal_uInt32 g); + +/** + * Add a glyph to a glyf table. + * + * @return glyphID of the glyph in the new font + * + * NOTE: This function does not duplicate GlyphData, so memory will be + * deallocated in the table destructor + */ + sal_uInt32 glyfAdd(TrueTypeTable *, GlyphData *glyphdata, TrueTypeFont *fnt); + +/** + * Query the number of glyphs currently stored in the 'glyf' table + * + */ + sal_uInt32 glyfCount(const TrueTypeTable *); + +/** + * Add a Name Record to a name table. + * NOTE: This function duplicates NameRecord, so the argument + * has to be deallocated by the caller (unlike glyfAdd) + */ + void nameAdd(TrueTypeTable *, NameRecord *nr); + +} // namespace + + +extern "C" +{ +/** + * Destructor for the TrueTypeTable object. + */ + void TrueTypeTableDispose(vcl::TrueTypeTable *); + +/** + * TrueTypeCreator destructor. It calls destructors for all TrueTypeTables added to it. + */ + void TrueTypeCreatorDispose(vcl::TrueTypeCreator *_this); +} + +#endif /* __TTCR_H */ |