First public contribution.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef __FNTRECRD_H__
21 #define __FNTRECRD_H__
31 const boolean PostureUpright = 0;
32 const boolean PostureItalic = 1;
36 const boolean StrokeWeightNormal = 0;
37 const boolean StrokeWeightBold = 1;
45 BitmapOffset(uint16 aBitmapOffset);
46 void Externalize(ostream& out);
48 uint16 iBitmapOffset; // restricts bitmap to 64k
51 class CharacterMetrics
58 void Externalize(ostream& out);
60 chardim iAscentInPixels;
61 chardim iHeightInPixels;
62 chardim iLeftAdjustInPixels;
63 chardim iMoveInPixels;
64 chardim iRightAdjustInPixels;
68 class MetricDistributionMember
70 Class which wraps up a given metric with the number of characters that use it
75 ~MetricDistributionMember();
76 MetricDistributionMember();
78 CharacterMetrics* Metric() const;
79 int Frequency() const;
80 void IncrementFrequency(int aIncrementBy = 1);
81 void SetMetric(CharacterMetrics* aMetric);
82 void SetFrequency(int aFrequency);
83 void Externalize(ostream& out);
86 CharacterMetrics* iMetric;
89 class MetricDistribution
91 Class which maintains a list of metrics and the number of characters using each,
92 along with the ability to sort them into most popular first order.
97 ~MetricDistribution();
98 static MetricDistribution* New();
100 void SortMetricsByFrequency();
101 void SetIndex(const CharacterMetrics& aMetrics, int aIndex);
102 int Index(const CharacterMetrics& aMetrics);
103 void Externalize(ostream& out);
104 void ExternalizeComponents(ostream& out);
105 void AddOrIncrementMetric(const CharacterMetrics& aMetrics, int aFrequency = 1);
106 const CharacterMetrics& MostPopular(int aStartIndex);
108 MetricDistribution();
110 ObjectList<MetricDistributionMember*> iCharacterMetricsList;
120 void Externalize(ostream& out);
121 ObjectList<BitmapOffset*> iBitmapOffsetList;
134 void AddBit(char aBit);
137 void Externalize(ostream& out);
143 class CharactersBitmap : public Record
149 void AddIndex(int aIndex);
150 void Externalize(ostream& out);
156 class BitmapCodeSection
162 void Externalize(ostream& out);
163 void ExternalizeComponents(ostream& out);
167 Characters iCharacters;
168 CharactersBitmap iCharactersBitmap;
171 class FontBitmap : public Record
178 void Externalize(ostream& out);
179 void ExternalizeComponents(ostream& out);
184 boolean iStrokeWeight;
185 boolean iIsProportional;
186 chardim iCellHeightInPixels;
187 chardim iAscentInPixels;
188 chardim iMaxCharWidthInPixels;
189 chardim iMaxNormalCharWidthInPixels;
190 int32 iBitmapEncoding;
191 ObjectList<BitmapCodeSection*> iCodeSectionList;
192 MetricDistribution* iCharacterMetrics;
195 class TypefaceFontBitmap
201 TypefaceFontBitmap(FontBitmap* aFontBitmap);
202 TypefaceFontBitmap(uid aFontBitmapUid);
203 void Externalize(ostream& out);
205 FontBitmap* iFontBitmap;
211 class FntTypeface : public Record, public Typeface
217 void Externalize(ostream& out);
219 ObjectList<TypefaceFontBitmap*> iTypefaceFontBitmapList;
222 class FontStoreFile : public Record
229 void AddTypeface(FntTypeface* aTypeface);
230 void AddFontBitmap(FontBitmap* aFontBitmap);
231 void Externalize(ostream& out);
233 void ExternalizeHeader(ostream& out);
234 void ExternalizeComponents(ostream& out);
237 int32 iKPixelAspectRatio;
238 ObjectList<String*> iCopyrightInfo;
240 streampos iDataStreamId;
241 RecordList iFontBitmapList;
242 RecordList iTypefaceList;
251 boolean Store(const String& aFilename);
252 void AddFontStoreFile(FontStoreFile* aFontStoreFile);
253 void AddFontBitmap(FontBitmap* aFontBitmap);
254 Record* FindFontBitmap(String& aLabel);
255 void AddTypeface(FntTypeface* aTypeface);
256 Record* FindTypeface(String& aLabel);
260 FontStoreFile* iFontStoreFile;
261 RecordList iFontBitmapList;
262 RecordList iTypefaceList;