1 //
2 // C++ Implementation: fmfontstrings
3 //
4 // Description:
5 //
6 //
7 // Author: Pierre Marchand <pierremarc@oep-h.com>, (C) 2008
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 
13 #include "fmfontstrings.h"
14 #include "fmpaths.h"
15 
16 #include <QFile>
17 
18 FontStrings * FontStrings::instance = 0;
FontStrings()19 FontStrings::FontStrings()
20 {
21 	fillNamesMeaning();
22 	fillPanoseMap();
23 	fillCharsetMap();
24 	fillTTTableList();
25 	fillFSftypeMap();
26 	fillUniCat();
27 	fillScriptTagNames();
28 }
29 
getInstance()30 FontStrings * FontStrings::getInstance()
31 {
32 	if(!instance)
33 		instance = new FontStrings;
34 	return instance;
35 }
36 
fillNamesMeaning()37 void FontStrings::fillNamesMeaning()
38 {
39 	m_name[FMFontDb::Copyright]= tr ( "Copyright" );
40 	m_name[FMFontDb::FontFamily]= tr ( "Font Family" );
41 	m_name[FMFontDb::FontSubfamily]= tr ( "Font Subfamily" );
42 	m_name[FMFontDb::UniqueFontIdentifier]= tr ( "Unique font identifier" );
43 	m_name[FMFontDb::FullFontName]= tr ( "Full font name" );
44 	m_name[FMFontDb::VersionString]= tr ( "Version string" );
45 	m_name[FMFontDb::PostscriptName]= tr ( "Postscript name" );
46 	m_name[FMFontDb::Trademark]= tr ( "Trademark" );
47 	m_name[FMFontDb::ManufacturerName]= tr ( "Manufacturer" );
48 	m_name[FMFontDb::Designer]= tr ( "Designer" );
49 	m_name[FMFontDb::Description]= tr ( "Description" );
50 	m_name[FMFontDb::URLVendor]= tr ( "URL Vendor" );
51 	m_name[FMFontDb::URLDesigner]= tr ( "URL Designer" );
52 	m_name[FMFontDb::LicenseDescription]= tr ( "License Description" );
53 	m_name[FMFontDb::LicenseInfoURL]= tr ( "License Info URL" );
54 	m_name[FMFontDb::PreferredFamily]= tr ( "Preferred Family" );
55 	m_name[FMFontDb::PreferredSubfamily]= tr ( "Preferred Subfamily" );
56 	m_name[FMFontDb::CompatibleMacintosh]= tr ( "Compatible Full (Macintosh only)" );
57 	m_name[FMFontDb::SampleText]= tr ( "Sample text" );
58 	m_name[FMFontDb::PostScriptCIDName]= tr ( "PostScript CID findfont name" );
59 // 	m_name[FMFontDb::Panose]= tr("Panose");
60 	m_name[FMFontDb::AllInfo]= tr("All fields");
61 
62 }
63 
fillPanoseMap()64 void FontStrings::fillPanoseMap()
65 {
66 // 	QString panofilepath( FMPaths::LocalizedFilePath(FMPaths::ResourcesDir() + "Panose", ".xml" ) );
67 // 	if(!panofilepath.isEmpty())
68 // 	{
69 // 		panoseFromFile(panofilepath);
70 // 		return;
71 // 	}
72 
73 	// http://www.microsoft.com/OpenType/OTSpec/os2ver0.htm#pan
74 	// http://www.monotypeimaging.com/ProductsServices/pan2.aspx
75 
76 		QMap<int, QString> mapModel;
77 		mapModel[ 0 ] = tr ( "Any" ) ;
78 		mapModel[ 1 ] = tr ( "No Fit" ) ;
79 		mapModel[ 2 ] = tr ( "Text and Display","Family Type" ) ;
80 		mapModel[ 3 ] = tr ( "Script" ,"Family Type" ) ;
81 		mapModel[ 4 ] = tr ( "Decorative","Family Type"  ) ;
82 		mapModel[ 5 ] = tr ( "Pictorial" ,"Family Type" ) ;
83 
84 		m_panoseMap[FamilyType] = mapModel;
85 		m_panoseKeyName[FamilyType] = tr ( "Family Type" );
86 		m_panoseKeyInfo[FamilyType] = "<h1>Family Kind</h1> Defines what type of font is being classified." ;
87 		mapModel.clear();
88 
89 		mapModel[ 0 ] = tr ( "Any" ) ;
90 		mapModel[ 1 ] = tr ( "No Fit" ) ;
91 		mapModel[ 2 ] = tr ( "Cove" ,"Serif style" ) ;
92 		mapModel[ 3 ] = tr ( "Obtuse Cove" ,"Serif style"  ) ;
93 		mapModel[ 4 ] = tr ( "Square Cove" ,"Serif style"  ) ;
94 		mapModel[ 5 ] = tr ( "Obtuse Square Cove"  ,"Serif style" ) ;
95 		mapModel[ 6 ] = tr ( "Square" ,"Serif style"  ) ;
96 		mapModel[ 7 ] = tr ( "Thin"  ,"Serif style" ) ;
97 		mapModel[ 8 ] = tr ( "Bone"  ,"Serif style" ) ;
98 		mapModel[ 9 ] = tr ( "Exaggerated"  ,"Serif style" ) ;
99 		mapModel[ 10 ] = tr ( "Triangle"  ,"Serif style" ) ;
100 		mapModel[ 11 ] = tr ( "Normal Sans"  ,"Serif style" ) ;
101 		mapModel[ 12 ] = tr ( "Obtuse Sans"  ,"Serif style" ) ;
102 		mapModel[ 13 ] = tr ( "Perp Sans" ,"Serif style"  ) ;
103 		mapModel[ 14 ] = tr ( "Flared"  ,"Serif style" ) ;
104 		mapModel[ 15 ] = tr ( "Rounded"  ,"Serif style" ) ;
105 
106 		m_panoseMap[SerifStyle ] = mapModel;
107 		m_panoseKeyName[SerifStyle] = tr ( "Serif style" ) ;
108 		m_panoseKeyInfo[SerifStyle] ="<h1>Serif style</h1>This digit describes the appearance of the serifs used in a font design";
109 		mapModel.clear();
110 
111 		mapModel[ 0 ] = tr ( "Any" ) ;
112 		mapModel[ 1 ] = tr ( "No Fit" ) ;
113 		mapModel[ 2 ] = tr ( "Very Light" ,"Weight" ) ;
114 		mapModel[ 3 ] = tr ( "Light" ,"Weight") ;
115 		mapModel[ 4 ] = tr ( "Thin" ,"Weight") ;
116 		mapModel[ 5 ] = tr ( "Book" ,"Weight") ;
117 		mapModel[ 6 ] = tr ( "Medium" ,"Weight") ;
118 		mapModel[ 7 ] = tr ( "Demi" ,"Weight") ;
119 		mapModel[ 8 ] = tr ( "Bold" ,"Weight") ;
120 		mapModel[ 9 ] = tr ( "Heavy" ,"Weight") ;
121 		mapModel[ 10 ] = tr ( "Black" ,"Weight") ;
122 		mapModel[ 11 ] = tr ( "Nord" ,"Weight") ;
123 
124 		m_panoseMap[Weight ] = mapModel;
125 		m_panoseKeyName[Weight] = tr ( "Weight" );
126 		m_panoseKeyInfo[Weight] ="<h1>Weight</h1>The Weight digit classifies the appearance of a fonts’ stroke thickness in relation to its height.";
127 		mapModel.clear();
128 
129 		mapModel[ 0 ] = tr ( "Any" ) ;
130 		mapModel[ 1 ] = tr ( "No Fit" ) ;
131 		mapModel[ 2 ] = tr ( "Old Style" ,"Proportion") ;
132 		mapModel[ 3 ] = tr ( "Modern" ,"Proportion" ) ;
133 		mapModel[ 4 ] = tr ( "Even Width" ,"Proportion" ) ;
134 		mapModel[ 5 ] = tr ( "Expanded" ,"Proportion" ) ;
135 		mapModel[ 6 ] = tr ( "Condensed"  ,"Proportion") ;
136 		mapModel[ 7 ] = tr ( "Very Expanded"  ,"Proportion") ;
137 		mapModel[ 8 ] = tr ( "Very Condensed"  ,"Proportion") ;
138 		mapModel[ 9 ] = tr ( "Monospaced"  ,"Proportion") ;
139 
140 		m_panoseMap[Proportion ] = mapModel;
141 		m_panoseKeyName[Proportion] = tr ( "Proportion" );
142 		m_panoseKeyInfo[Proportion] ="<h1>Proportion</h1>The proportion of a font in the PANOSE Typeface Matching System is defined in greater detail than simply an indication of general glyph shape aspect ratio such as extended and condensed.";
143 		mapModel.clear();
144 
145 		mapModel[ 0 ] = tr ( "Any" ) ;
146 		mapModel[ 1 ] = tr ( "No Fit" ) ;
147 		mapModel[ 2 ] = tr ( "None" ,"Contrast") ;
148 		mapModel[ 3 ] = tr ( "Very Low" ,"Contrast") ;
149 		mapModel[ 4 ] = tr ( "Low" ,"Contrast") ;
150 		mapModel[ 5 ] = tr ( "Medium Low" ,"Contrast") ;
151 		mapModel[ 6 ] = tr ( "Medium" ,"Contrast") ;
152 		mapModel[ 7 ] = tr ( "Medium High" ,"Contrast") ;
153 		mapModel[ 8 ] = tr ( "High" ,"Contrast") ;
154 		mapModel[ 9 ] = tr ( "Very High" ,"Contrast") ;
155 
156 		m_panoseMap[Contrast ] = mapModel;
157 		m_panoseKeyName[Contrast] = tr ( "Contrast" );
158 		m_panoseKeyInfo[Contrast] ="<h1>Contrast</h1>The Contrast digit describes the ratio between the thickest point on the stroke of the letter O and the narrowest point on the letter O.";
159 		mapModel.clear();
160 
161 		mapModel[ 0 ] = tr ( "Any" ) ;
162 		mapModel[ 1 ] = tr ( "No Fit" ) ;
163 		mapModel[ 2 ] = tr ( "Gradual/Diagonal" , "Stroke Variation") ;
164 		mapModel[ 3 ] = tr ( "Gradual/Transitional"  , "Stroke Variation") ;
165 		mapModel[ 4 ] = tr ( "Gradual/Vertical" , "Stroke Variation" ) ;
166 		mapModel[ 5 ] = tr ( "Gradual/Horizontal" , "Stroke Variation" ) ;
167 		mapModel[ 6 ] = tr ( "Rapid/Vertical"  , "Stroke Variation") ;
168 		mapModel[ 7 ] = tr ( "Rapid/Horizontal"  , "Stroke Variation") ;
169 		mapModel[ 8 ] = tr ( "Instant/Vertical"  , "Stroke Variation") ;
170 
171 		m_panoseMap[StrokeVariation] = mapModel;
172 		m_panoseKeyName[StrokeVariation] = tr ( "Stroke Variation" );
173 		m_panoseKeyInfo[StrokeVariation] ="<h1>Stroke Variation</h1>The Stroke Variation category further details the contrast trait by describing the kind of transition that occurs as the stem thickness changes on rounded glyph shapes.";
174 		mapModel.clear();
175 
176 		mapModel[ 0 ] = tr ( "Any" ) ;
177 		mapModel[ 1 ] = tr ( "No Fit" ) ;
178 		mapModel[ 2 ] = tr ( "Straight Arms/Horizontal" ,"Arm Style") ;
179 		mapModel[ 3 ] = tr ( "Straight Arms/Wedge" ,"Arm Style") ;
180 		mapModel[ 4 ] = tr ( "Straight Arms/Vertical" ,"Arm Style") ;
181 		mapModel[ 5 ] = tr ( "Straight Arms/Single Serif","Arm Style" ) ;
182 		mapModel[ 6 ] = tr ( "Straight Arms/Double Serif","Arm Style" ) ;
183 		mapModel[ 7 ] = tr ( "Non-Straight Arms/Horizontal" ,"Arm Style") ;
184 		mapModel[ 8 ] = tr ( "Non-Straight Arms/Wedge" ,"Arm Style") ;
185 		mapModel[ 9 ] = tr ( "Non-Straight Arms/Vertical" ,"Arm Style") ;
186 		mapModel[ 10 ] = tr ( "Non-Straight Arms/Single Serif","Arm Style" ) ;
187 		mapModel[ 11 ] = tr ( "Non-Straight Arms/Double Serif" ,"Arm Style") ;
188 
189 		m_panoseMap[ArmStyle ] = mapModel;
190 		m_panoseKeyName[ArmStyle] = tr ( "Arm Style" );
191 		m_panoseKeyInfo[ArmStyle] ="<h1>Arm Style</h1>The Arm Style category classifies two attributes of a glyph design: special treatment of diagonal stems and termination of open rounded letterforms.";
192 		mapModel.clear();
193 
194 		mapModel[ 0 ] = tr ( "Any" ) ;
195 		mapModel[ 1 ] = tr ( "No Fit" ) ;
196 		mapModel[ 2 ] = tr ( "Normal/Contact" , "Letterform" ) ;
197 		mapModel[ 3 ] = tr ( "Normal/Weighted" , "Letterform" ) ;
198 		mapModel[ 4 ] = tr ( "Normal/Boxed" , "Letterform");
199 		mapModel[ 5 ] = tr ( "Normal/Flattened", "Letterform" ) ;
200 		mapModel[ 6 ] = tr ( "Normal/Rounded" , "Letterform") ;
201 		mapModel[ 7 ] = tr ( "Normal/Off Center" , "Letterform") ;
202 		mapModel[ 8 ] = tr ( "Normal/Square" , "Letterform") ;
203 		mapModel[ 9 ] = tr ( "Oblique/Contact" , "Letterform") ;
204 		mapModel[ 10 ] = tr ( "Oblique/Weighted" , "Letterform") ;
205 		mapModel[ 11 ] = tr ( "Oblique/Boxed" , "Letterform") ;
206 		mapModel[ 12 ] = tr ( "Oblique/Flattened" , "Letterform") ;
207 		mapModel[ 13 ] = tr ( "Oblique/Rounded" , "Letterform") ;
208 		mapModel[ 14 ] = tr ( "Oblique/Off Center" , "Letterform") ;
209 		mapModel[ 15 ] = tr ( "Oblique/Square" , "Letterform") ;
210 
211 		m_panoseMap[Letterform] = mapModel;
212 		m_panoseKeyName[Letterform] = tr ( "Letterform" );
213 		m_panoseKeyInfo[Letterform] ="<h1>Letterform</h1>Roundness and predominant skewing is classified in the Letterform category.";
214 		mapModel.clear();
215 
216 		mapModel[ 0 ] = tr ( "Any" ) ;
217 		mapModel[ 1 ] = tr ( "No Fit" ) ;
218 		mapModel[ 2 ] = tr ( "Standard/Trimmed" ,"Midline") ;
219 		mapModel[ 3 ] = tr ( "Standard/Pointed" ,"Midline") ;
220 		mapModel[ 4 ] = tr ( "Standard/Serifed","Midline" ) ;
221 		mapModel[ 5 ] = tr ( "High/Trimmed" ,"Midline") ;
222 		mapModel[ 6 ] = tr ( "High/Pointed" ,"Midline") ;
223 		mapModel[ 7 ] = tr ( "High/Serifed","Midline" ) ;
224 		mapModel[ 8 ] = tr ( "Constant/Trimmed" ,"Midline") ;
225 		mapModel[ 9 ] = tr ( "Constant/Pointed" ,"Midline") ;
226 		mapModel[ 10 ] = tr ( "Constant/Serifed" ,"Midline") ;
227 		mapModel[ 11 ] = tr ( "Low/Trimmed" ,"Midline") ;
228 		mapModel[ 12 ] = tr ( "Low/Pointed" ,"Midline") ;
229 		mapModel[ 13 ] = tr ( "Low/Serifed" ,"Midline") ;
230 
231 		m_panoseMap[Midline ] = mapModel;
232 		m_panoseKeyName[Midline] = tr ( "Midline" );
233 		m_panoseKeyInfo[Midline] ="<h1>Midline</h1>The ninth category in the PANOSE classification system analyzes two traits, the placement of the midline across the uppercase characters and the treatment of diagonal stem apexes.";
234 		mapModel.clear();
235 
236 		mapModel[ 0 ] = tr ( "Any" ) ;
237 		mapModel[ 1 ] = tr ( "No Fit" ) ;
238 		mapModel[ 2 ] = tr ( "Constant/Small" , "X-Height") ;
239 		mapModel[ 3 ] = tr ( "Constant/Standard" , "X-Height") ;
240 		mapModel[ 4 ] = tr ( "Constant/Large" , "X-Height") ;
241 		mapModel[ 5 ] = tr ( "Ducking/Small" , "X-Height") ;
242 		mapModel[ 6 ] = tr ( "Ducking/Standard" , "X-Height") ;
243 		mapModel[ 7 ] = tr ( "Ducking/Large" , "X-Height") ;
244 
245 		m_panoseMap[XHeight ] = mapModel;
246 		m_panoseKeyName[XHeight] = tr ( "X-Height" );
247 		m_panoseKeyInfo[XHeight] ="<h1>X-Height</h1>Two different traits are represented in the X-height digit: the treatment of uppercase glyphs with diacritical marks and the relative size of the lowercase characters.";
248 
249 }
250 
panoseFromFile(const QString & path)251 void FontStrings::panoseFromFile(const QString & path)
252 {
253 	return;
254 }
fillCharsetMap()255 void FontStrings::fillCharsetMap()
256 {
257 	charsetMap[FT_ENCODING_NONE] = "None";
258 	charsetMap[FT_ENCODING_UNICODE] = "Unicode";
259 	charsetMap[FT_ENCODING_MS_SYMBOL] = "MS Symbol";
260 	charsetMap[FT_ENCODING_SJIS] = "SJIS";
261 	charsetMap[FT_ENCODING_GB2312	] = "GB2312";
262 	charsetMap[FT_ENCODING_BIG5] = "BIG5";
263 	charsetMap[FT_ENCODING_WANSUNG] = "Wansung";
264 	charsetMap[FT_ENCODING_JOHAB] = "Johab";
265 	charsetMap[FT_ENCODING_ADOBE_LATIN_1] = "Adobe Latin 1";
266 	charsetMap[FT_ENCODING_ADOBE_STANDARD] = "Adobe Standard";
267 	charsetMap[FT_ENCODING_ADOBE_EXPERT] = "Adobe Expert";
268 	charsetMap[FT_ENCODING_ADOBE_CUSTOM] = "Adobe Custom";
269 	charsetMap[FT_ENCODING_APPLE_ROMAN] = "Apple Roman";
270 	charsetMap[FT_ENCODING_OLD_LATIN_2] = tr ( "This value is deprecated and was never used nor reported by FreeType. Don't use or test for it." );
271 	charsetMap[FT_ENCODING_MS_SJIS] = "MS SJIS";
272 	charsetMap[FT_ENCODING_MS_GB2312] = "MS GB2312";
273 	charsetMap[FT_ENCODING_MS_BIG5] = "MS BIG5";
274 	charsetMap[FT_ENCODING_MS_WANSUNG] = "MS Wansung";
275 	charsetMap[FT_ENCODING_MS_JOHAB] = "MS Johab";
276 }
277 
fillTTTableList()278 void FontStrings::fillTTTableList()
279 {
280 	tttableList.clear();
281 
282 	// Required Tables
283 	tttableList["cmap"] = tr("Character to glyph mapping");
284 	tttableList["head"] = tr("Font header");
285 	tttableList["hhea"] = tr("Horizontal header");
286 	tttableList["hmtx"] = tr("Horizontal metrics");
287 	tttableList["maxp"] = tr("Maximum profile");
288 	tttableList["name"] = tr("Naming table");
289 	tttableList["OS/2"] = tr("OS/2 and Windows specific metrics");
290 	tttableList["post"] = tr("PostScript information");
291 
292 	// Tables Related to TrueType Outlines
293 	tttableList["cvt"] = tr("Control Value Table");
294 	tttableList["fpgm"] = tr("Font program");
295 	tttableList["glyf"] = tr("Glyph data");
296 	tttableList["loca"] = tr("Index to location");
297 	tttableList["prep"] = tr("CVT Program");
298 
299 	// Tables Related to PostScript Outlines
300 	tttableList["CFF"] = tr("PostScript font program");
301 	tttableList["VORG"] = tr("Vertical Origin");
302 
303 	// Tables Related to Bitmap Glyphs
304 	tttableList["EBDT"] = tr("Embedded bitmap data");
305 	tttableList["EBLC"] = tr("Embedded bitmap location data");
306 	tttableList["EBSC"] = tr("Embedded bitmap scaling data");
307 
308 	// Advanced Typographic Tables
309 	tttableList["BASE"] = tr("Baseline data");
310 	tttableList["GDEF"] = tr("Glyph definition data");
311 	tttableList["GPOS"] = tr("Glyph positioning data");
312 	tttableList["GSUB"] = tr("Glyph substitution data");
313 	tttableList["JSTF"] = tr("Justification data");
314 
315 	// Other OpenType Tables
316 	tttableList["DSIG"] = tr("Digital signature");
317 	tttableList["gasp"] = tr("Grid-fitting/Scan-conversion");
318 	tttableList["hdmx"] = tr("Horizontal device metrics");
319 	tttableList["kern"] = tr("Kerning");
320 	tttableList["LTSH"] = tr("Linear threshold data");
321 	tttableList["PCLT"] = tr("PCL 5 data");
322 	tttableList["VDMX"] = tr("Vertical device metrics");
323 	tttableList["vhea"] = tr("Vertical Metrics header");
324 	tttableList["vmtx"] = tr("Vertical Metrics");
325 }
326 
327 
fillFSftypeMap()328 void FontStrings::fillFSftypeMap()
329 {
330 	// From http://www.microsoft.com/typography/otspec/os2.htm#fst
331 
332 	m_FsType[FontItem::NOT_RESTRICTED] = tr("This font may be embedded and permanently installed on the remote system by an application. The user of the remote system acquires the identical rights, obligations and licenses for that font as the original purchaser of the font, and is subject to the same end-user license agreement, copyright, design patent, and/or trademark as was the original purchaser.");
333 	m_FsType[FontItem::RESTRICTED] = tr("This font must not be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner.");
334 	m_FsType[FontItem::PREVIEW_PRINT] = tr("This font may be embedded, and temporarily loaded on the remote system. Documents containing this font must be opened \"read-only;\" no edits can be applied to the document.");
335 	m_FsType[FontItem::EDIT_EMBED] = tr("This font may be embedded but must only be installed  temporarily  on other systems. In contrast to Preview &amp; Print fonts, documents containing this font may be opened for reading, editing is permitted, and changes may be saved.");
336 	m_FsType[FontItem::NOSUBSET] = tr("This font may not be subsetted prior to embedding. Other embedding restrictions specified in bits 0-3 and 9 also apply.");
337 	m_FsType[FontItem::BITMAP_ONLY] = tr("Only bitmaps contained in this font may be embedded. No outline data may be embedded. If there are no bitmaps available in this font, then it is considered unembeddable and the embedding services will fail. Other embedding restrictions specified in bits 0-3 and 8 also apply.");
338 }
339 
fillUniCat()340 void FontStrings::fillUniCat()
341 {
342 	unicodeCategory[QChar::Mark_NonSpacing] = tr("Mark, NonSpacing" );
343 	unicodeCategory[QChar::Mark_SpacingCombining] = tr("Mark, SpacingCombining" );
344 	unicodeCategory[QChar::Mark_Enclosing] = tr("Mark, Enclosing" );
345 	unicodeCategory[QChar::Number_DecimalDigit] = tr("Number, DecimalDigit" );
346 	unicodeCategory[QChar::Number_Letter] = tr("Number, Letter" );
347 	unicodeCategory[QChar::Number_Other] = tr("Number, Other" );
348 	unicodeCategory[QChar::Separator_Space] = tr("Separator, Space" );
349 	unicodeCategory[QChar::Separator_Line] = tr("Separator, Line" );
350 	unicodeCategory[QChar::Separator_Paragraph] = tr("Separator, Paragraph" );
351 	unicodeCategory[QChar::Other_Control] = tr("Other, Control" );
352 	unicodeCategory[QChar::Other_Format] = tr("Other, Format" );
353 	unicodeCategory[QChar::Other_Surrogate] = tr("Other, Surrogate" );
354 	unicodeCategory[QChar::Other_PrivateUse] = tr("Other, PrivateUse" );
355 	unicodeCategory[QChar::Other_NotAssigned] = tr("Other, NotAssigned" );
356 	unicodeCategory[QChar::Letter_Uppercase] = tr("Letter, Uppercase" );
357 	unicodeCategory[QChar::Letter_Lowercase] = tr("Letter, Lowercase" );
358 	unicodeCategory[QChar::Letter_Titlecase] = tr("Letter, Titlecase" );
359 	unicodeCategory[QChar::Letter_Modifier] = tr("Letter, Modifier" );
360 	unicodeCategory[QChar::Letter_Other] = tr("Letter, Other" );
361 	unicodeCategory[QChar::Punctuation_Connector] = tr("Punctuation, Connector" );
362 	unicodeCategory[QChar::Punctuation_Dash] = tr("Punctuation, Dash" );
363 	unicodeCategory[QChar::Punctuation_Open] = tr("Punctuation, Open" );
364 	unicodeCategory[QChar::Punctuation_Close] = tr("Punctuation, Close" );
365 	unicodeCategory[QChar::Punctuation_InitialQuote] = tr("Punctuation, InitialQuote" );
366 	unicodeCategory[QChar::Punctuation_FinalQuote] = tr("Punctuation, FinalQuote" );
367 	unicodeCategory[QChar::Punctuation_Other] = tr("Punctuation, Other" );
368 	unicodeCategory[QChar::Symbol_Math] = tr("Symbol, Math" );
369 	unicodeCategory[QChar::Symbol_Currency] = tr("Symbol, Currency" );
370 	unicodeCategory[QChar::Symbol_Modifier] = tr("Symbol, Modifier" );
371 	unicodeCategory[QChar::Symbol_Other] = tr("Symbol, Other" );
372 }
373 
fillScriptTagNames()374 void FontStrings::fillScriptTagNames()
375 {
376 	scriptTagNames[QString("arab")] = tr("Arabic");
377 	scriptTagNames[QString("armn")] = tr("Armenian");
378 	scriptTagNames[QString("bali")] = tr("Balinese");
379 	scriptTagNames[QString("beng")] = tr("Bengali");
380 	scriptTagNames[QString("bopo")] = tr("Bopomofo");
381 	scriptTagNames[QString("brai")] = tr("Braille");
382 	scriptTagNames[QString("bugi")] = tr("Buginese");
383 	scriptTagNames[QString("buhd")] = tr("Buhid");
384 	scriptTagNames[QString("byzm")] = tr("Byzantine Music");
385 	scriptTagNames[QString("cans")] = tr("Canadian Syllabics");
386 	scriptTagNames[QString("cher")] = tr("Cherokee");
387 	scriptTagNames[QString("hani")] = tr("CJK Ideographic");
388 	scriptTagNames[QString("copt")] = tr("Coptic");
389 	scriptTagNames[QString("cprt")] = tr("Cypriot Syllabary");
390 	scriptTagNames[QString("cyrl")] = tr("Cyrillic");
391 	scriptTagNames[QString("DFLT")] = tr("Default");
392 	scriptTagNames[QString("dsrt")] = tr("Deseret");
393 	scriptTagNames[QString("deva")] = tr("Devanagari");
394 	scriptTagNames[QString("ethi")] = tr("Ethiopic");
395 	scriptTagNames[QString("geor")] = tr("Georgian");
396 	scriptTagNames[QString("glag")] = tr("Glagolitic");
397 	scriptTagNames[QString("goth")] = tr("Gothic");
398 	scriptTagNames[QString("grek")] = tr("Greek");
399 	scriptTagNames[QString("gujr")] = tr("Gujarati");
400 	scriptTagNames[QString("guru")] = tr("Gurmukhi");
401 	scriptTagNames[QString("jamo")] = tr("Hangul Jamo");
402 	scriptTagNames[QString("hang")] = tr("Hangul");
403 	scriptTagNames[QString("hano")] = tr("Hanunoo");
404 	scriptTagNames[QString("hebr")] = tr("Hebrew");
405 	scriptTagNames[QString("kana")] = tr("Hiragana and Katakana");
406 	scriptTagNames[QString("java")] = tr("Javanese");
407 	scriptTagNames[QString("knda")] = tr("Kannada");
408 	scriptTagNames[QString("khar")] = tr("Kharosthi");
409 	scriptTagNames[QString("khmr")] = tr("Khmer");
410 	scriptTagNames[QString("lao ")] = tr("Lao");
411 	scriptTagNames[QString("latn")] = tr("Latin");
412 	scriptTagNames[QString("limb")] = tr("Limbu");
413 	scriptTagNames[QString("linb")] = tr("Linear B");
414 	scriptTagNames[QString("mlym")] = tr("Malayalam");
415 	scriptTagNames[QString("math")] = tr("Mathematical Alphanumeric Symbols");
416 	scriptTagNames[QString("mong")] = tr("Mongolian");
417 	scriptTagNames[QString("musc")] = tr("Musical Symbols");
418 	scriptTagNames[QString("mymr")] = tr("Myanmar");
419 	scriptTagNames[QString("nko ")] = tr("N'ko");
420 	scriptTagNames[QString("ogam")] = tr("Ogham");
421 	scriptTagNames[QString("ital")] = tr("Old Italic");
422 	scriptTagNames[QString("xpeo")] = tr("Old Persian Cuneiform");
423 	scriptTagNames[QString("orya")] = tr("Oriya");
424 	scriptTagNames[QString("osma")] = tr("Osmanya");
425 	scriptTagNames[QString("phag")] = tr("Phags-pa");
426 	scriptTagNames[QString("phnx")] = tr("Phoenician");
427 	scriptTagNames[QString("runr")] = tr("Runic");
428 	scriptTagNames[QString("shaw")] = tr("Shavian");
429 	scriptTagNames[QString("sinh")] = tr("Sinhala");
430 	scriptTagNames[QString("xsux")] = tr("Sumero-Akkadian Cuneiform");
431 	scriptTagNames[QString("sylo")] = tr("Syloti Nagri");
432 	scriptTagNames[QString("syrc")] = tr("Syriac");
433 	scriptTagNames[QString("tglg")] = tr("Tagalog");
434 	scriptTagNames[QString("tagb")] = tr("Tagbanwa");
435 	scriptTagNames[QString("tale")] = tr("Tai Le");
436 	scriptTagNames[QString("talu")] = tr("Tai Lu");
437 	scriptTagNames[QString("taml")] = tr("Tamil");
438 	scriptTagNames[QString("telu")] = tr("Telugu");
439 	scriptTagNames[QString("thaa")] = tr("Thaana");
440 	scriptTagNames[QString("thai")] = tr("Thai");
441 	scriptTagNames[QString("tibt")] = tr("Tibetan");
442 	scriptTagNames[QString("tfng")] = tr("Tifinagh");
443 	scriptTagNames[QString("ugar")] = tr("Ugaritic Cuneiform");
444 	scriptTagNames[QString("yi ")] = tr("Yi");
445 }
446 
Names()447 const QMap< FMFontDb::InfoItem, QString >& FontStrings::Names()
448 {
449 	FontStrings *that(getInstance());
450 	return that->m_name;
451 }
452 
Panose()453 const QMap< FontStrings::PanoseKey, QMap < int , QString > >& FontStrings::Panose()
454 {
455 	FontStrings *that(getInstance());
456 	return that->m_panoseMap;
457 }
458 
PanoseKeyName(PanoseKey pk)459 const QString FontStrings::PanoseKeyName(PanoseKey pk)
460 {
461 	FontStrings *that(getInstance());
462 	return that->m_panoseKeyName.value(pk);
463 }
464 
PanoseKeyInfo(PanoseKey pk)465 const QString FontStrings::PanoseKeyInfo(PanoseKey pk)
466 {
467 	FontStrings *that(getInstance());
468 	return that->m_panoseKeyInfo.value(pk);
469 }
470 
Encoding(FT_Encoding enc)471 const QString FontStrings::Encoding(FT_Encoding enc)
472 {
473 	FontStrings *that(getInstance());
474 	return that->charsetMap.value(enc);
475 }
476 
Tables()477 const QMap< QString, QString > & FontStrings::Tables()
478 {
479 	FontStrings *that(getInstance());
480 	return that->tttableList;
481 }
482 
FsType(int fstype_part,bool shortString)483 QString FontStrings::FsType(int fstype_part, bool shortString)
484 {
485 	FontStrings *that(getInstance());
486 	if(!shortString)
487 		return that->m_FsType[fstype_part];
488 	else
489 	{
490 		if(FontItem::NOT_RESTRICTED == fstype_part)
491 			return tr("Not Restricted");
492 		else if(FontItem::RESTRICTED == fstype_part)
493 			return tr("Restricted");
494 		else if(FontItem::PREVIEW_PRINT == fstype_part)
495 			return tr("Preview/Print");
496 		else if(FontItem::EDIT_EMBED == fstype_part)
497 			return tr("Edit/Embed");
498 		else if(FontItem::NOSUBSET == fstype_part)
499 			return tr("No Subset");
500 		else if(FontItem::BITMAP_ONLY == fstype_part)
501 			return tr("Bitmap Only");
502 	}
503 
504 	return QString();
505 }
506 
firstPanoseKey()507 FontStrings::PanoseKey FontStrings::firstPanoseKey()
508 {
509 	return FamilyType;
510 }
511 
nextPanoseKey(PanoseKey pk)512 FontStrings::PanoseKey FontStrings::nextPanoseKey ( PanoseKey pk )
513 {
514 	switch ( pk )
515 	{
516 		case FamilyType:return SerifStyle;break;
517 		case SerifStyle:return Weight;break;
518 		case Weight:return Proportion;break;
519 		case Proportion:return Contrast;break;
520 		case Contrast:return StrokeVariation;break;
521 		case StrokeVariation:return ArmStyle;break;
522 		case ArmStyle:return Letterform;break;
523 		case Letterform:return Midline;break;
524 		case Midline:return XHeight;break;
525 		default:return InvalidPK;
526 	}
527 	return InvalidPK;
528 }
529 
UnicodeCategory(QChar::Category cat)530 QString FontStrings::UnicodeCategory(QChar::Category cat)
531 {
532 	if(getInstance()->unicodeCategory.contains(cat))
533 		return getInstance()->unicodeCategory.value(cat);
534 	return QString();
535 }
536 
scriptTagName(const QString & script)537 QString FontStrings::scriptTagName(const QString &script)
538 {
539 	if(getInstance()->scriptTagNames.contains(script))
540 		return getInstance()->scriptTagNames.value(script);
541 	return script;
542 }
543 
544