1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  *   Copyright (C) 2004 by Riku Leino                                      *
9  *   tsoots@gmail.com                                                      *
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  *   This program is distributed in the hope that it will be useful,       *
17  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19  *   GNU General Public License for more details.                          *
20  *                                                                         *
21  *   You should have received a copy of the GNU General Public License     *
22  *   along with this program; if not, write to the                         *
23  *   Free Software Foundation, Inc.,                                       *
24  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
25  ***************************************************************************/
26 
27 #include "gtfont.h"
28 
29 const QString gtFont::fontWeights[FontWeightMAX] =
30 {
31 	"",
32 	"Demi Bold",
33 	"Extra Black",
34 	"Extra Bold",
35 	"Extra Heavy",
36 	"Extra Light",
37 	"Semi Bold",
38 	"Black",
39 	"Bold",
40 	"Book",
41 	"Demi",
42 	"Heavy",
43 	"Light",
44 	"Lite",
45 	"Medium",
46 	"Regular",
47 	"Roman"
48 };
49 
50 const QString gtFont::fontSlants[FontSlantMAX] =
51 {
52 	"",
53 	"Italic",
54 	"Oblique"
55 };
56 
57 const QString gtFont::fontWidths[FontWidthMAX] =
58 {
59 	"",
60 	"Extra Condensed",
61 	"Semi Condensed",
62 	"Ultra Condensed",
63 	"Extra Compressed",
64 	"Semi Compressed",
65 	"Ultra Compressed",
66 	"Condensed",
67 	"Compressed"
68 };
69 
gtFont()70 gtFont::gtFont()
71 {
72 	noEffects();
73 }
74 
gtFont(const gtFont & f)75 gtFont::gtFont(const gtFont& f)
76 {
77 	m_name        = f.m_name;
78 	m_family      = f.m_family;
79 	m_weight      = f.m_weight;
80 	m_slant       = f.m_slant;
81 	m_width       = f.m_width;
82 	m_append      = f.m_append;
83 	m_size        = f.m_size;
84 	m_color       = f.m_color;
85 	m_shade       = f.m_shade;
86 	m_strokeColor = f.m_strokeColor;
87 	m_strokeShade = f.m_strokeShade;
88 	m_hscale      = f.m_hscale;
89 	m_kerning     = f.m_kerning;
90 	m_useFullName = f.m_useFullName;
91 	m_weightIndex = f.m_weightIndex;
92 	m_slantIndex  = f.m_slantIndex;
93 	m_widthIndex  = f.m_widthIndex;
94 	m_smallestIndex  = f.m_smallestIndex;
95 	m_biggestIndex   = f.m_biggestIndex;
96 	m_index          = f.m_index;
97 	m_tmpWeightIndex = f.m_tmpWeightIndex;
98 	m_tmpSlantIndex  = f.m_tmpSlantIndex;
99 	m_tmpWidthIndex  = f.m_tmpWidthIndex;
100 	m_fontEffects[NORMAL]        = f.m_fontEffects[NORMAL];
101 	m_fontEffects[UNDERLINE]     = f.m_fontEffects[UNDERLINE];
102 	m_fontEffects[STRIKETHROUGH] = f.m_fontEffects[STRIKETHROUGH];
103 	m_fontEffects[SMALL_CAPS]    = f.m_fontEffects[SMALL_CAPS];
104 	m_fontEffects[SUPERSCRIPT]   = f.m_fontEffects[SUPERSCRIPT];
105 	m_fontEffects[SUBSCRIPT]     = f.m_fontEffects[SUBSCRIPT];
106 	m_fontEffects[OUTLINE]       = f.m_fontEffects[OUTLINE];
107 	m_setflags = f.m_setflags;
108 }
109 
getFlags()110 int gtFont::getFlags()
111 {
112 	return m_setflags;
113 }
114 
isToggled(FontEffect fe)115 bool gtFont::isToggled(FontEffect fe)
116 {
117 	return m_fontEffects[fe];
118 }
119 
toggleEffect(FontEffect fe)120 bool gtFont::toggleEffect(FontEffect fe)
121 {
122 	switch (fe)
123 	{
124 		case NORMAL:
125 			if (!m_fontEffects[NORMAL])
126 				noEffects();
127 			break;
128 		case SUPERSCRIPT:
129 			m_fontEffects[SUPERSCRIPT] = !m_fontEffects[SUPERSCRIPT];
130 			if (m_fontEffects[SUPERSCRIPT])
131 			{
132 				m_fontEffects[SUBSCRIPT] = false;
133 				m_fontEffects[NORMAL] = false;
134 			}
135 			break;
136 		case SUBSCRIPT:
137 			m_fontEffects[SUBSCRIPT] = !m_fontEffects[SUBSCRIPT];
138 			if (m_fontEffects[SUBSCRIPT])
139 			{
140 				m_fontEffects[SUPERSCRIPT] = false;
141 				m_fontEffects[NORMAL] = false;
142 			}
143 			break;
144 		default:
145 			m_fontEffects[fe] = !m_fontEffects[fe];
146 			if (m_fontEffects[fe])
147 				m_fontEffects[NORMAL] = false;
148 	}
149 	m_setflags |= effectWasSet;
150 	return m_fontEffects[fe];
151 }
152 
getEffectsValue()153 int gtFont::getEffectsValue()
154 {
155 	int b = 0;
156 	if (isToggled(NORMAL))
157 		b = 0;
158 	if (isToggled(UNDERLINE))
159 		b |= 8;
160 	if (isToggled(STRIKETHROUGH))
161 		b |= 16;
162 	if (isToggled(SMALL_CAPS))
163 		b |= 64;
164 	if (isToggled(SUPERSCRIPT))
165 		b |= 1;
166 	if (isToggled(SUBSCRIPT))
167 		b |= 2;
168 	if (isToggled(OUTLINE))
169 		b |= 4;
170 	return b;
171 }
172 
setName(const QString & newName)173 void gtFont::setName(const QString& newName)
174 {
175 	m_name = newName;
176 	setWeight(NO_WEIGHT);
177 	setSlant(NO_SLANT);
178 	setWidth(NO_WIDTH);
179 	parseName();
180 	m_useFullName = true;
181 	m_setflags |= familyWasSet;
182 }
183 
setFamily(const QString & newFamily)184 void gtFont::setFamily(const QString& newFamily)
185 {
186 	m_family = newFamily;
187 	m_useFullName = false;
188 	m_setflags |= familyWasSet;
189 }
190 
getFamily()191 QString gtFont::getFamily()
192 {
193 	return m_family;
194 }
195 
setWeight(FontWeight newWeight)196 void gtFont::setWeight(FontWeight newWeight)
197 {
198 	m_weight = fontWeights[newWeight];
199 	m_useFullName = false;
200 	m_setflags |= weightWasSet;
201 	if ((newWeight == ROMAN) || (newWeight == REGULAR))
202 	{
203 		setSlant(NO_SLANT);
204 		setWidth(NO_WIDTH);
205 		m_setflags &= ~weightWasSet;
206 	}
207 	if (m_weightIndex < 0)
208 	{
209 		m_weightIndex = 0;
210 		m_slantIndex = 1;
211 		m_widthIndex = 2;
212 	}
213 }
214 
setWeight(const QString & newWeight)215 void gtFont::setWeight(const QString& newWeight)
216 {
217 	m_weight = newWeight;
218 	m_useFullName = false;
219 	m_setflags |= weightWasSet;
220 	if ((newWeight == fontWeights[ROMAN]) ||
221 		(newWeight == fontWeights[REGULAR]))
222 	{
223 		setSlant(NO_SLANT);
224 		setWidth(NO_WIDTH);
225 		m_setflags &= ~weightWasSet;
226 	}
227 	if (m_weightIndex < 0)
228 	{
229 		m_weightIndex = 0;
230 		m_slantIndex = 1;
231 		m_widthIndex = 2;
232 	}
233 }
234 
getWeight()235 QString gtFont::getWeight()
236 {
237 	return m_weight;
238 }
239 
setSlant(FontSlant newSlant)240 void gtFont::setSlant(FontSlant newSlant)
241 {
242 	m_slant = fontSlants[newSlant];
243 	m_useFullName = false;
244 	m_setflags &= ~slantWasSet;
245 	if (newSlant != NO_SLANT)
246 	{
247 		if (m_weight == fontWeights[REGULAR])
248 			setWeight(NO_WEIGHT);
249 		else if (m_weight == fontWeights[ROMAN])
250 			setWeight(NO_WEIGHT);
251 		m_setflags |= slantWasSet;
252 	}
253 	if (m_slantIndex < 0)
254 	{
255 		m_weightIndex = 0;
256 		m_slantIndex = 1;
257 		m_widthIndex = 2;
258 	}
259 }
260 
setSlant(const QString & newSlant)261 void gtFont::setSlant(const QString& newSlant)
262 {
263 	m_slant = newSlant;
264 	m_useFullName = false;
265 	m_setflags &= ~slantWasSet;
266 	if (!newSlant.isEmpty())
267 	{
268 		if (m_weight == fontWeights[REGULAR])
269 			setWeight(NO_WEIGHT);
270 		else if (m_weight == fontWeights[ROMAN])
271 			setWeight(NO_WEIGHT);
272 		m_setflags |= slantWasSet;
273 	}
274 	if (m_slantIndex < 0)
275 	{
276 		m_weightIndex = 0;
277 		m_slantIndex = 1;
278 		m_widthIndex = 2;
279 	}
280 }
281 
getSlant()282 QString gtFont::getSlant()
283 {
284 	return m_slant;
285 }
286 
setWidth(FontWidth newWidth)287 void gtFont::setWidth(FontWidth newWidth)
288 {
289 	m_width = fontWidths[newWidth];
290 	m_useFullName = false;
291 	m_setflags &= ~widthWasSet;
292 	if (newWidth != NO_WIDTH)
293 	{
294 		if (m_weight == fontWeights[REGULAR])
295 			setWeight(NO_WEIGHT);
296 		else if (m_weight == fontWeights[ROMAN])
297 			setWeight(NO_WEIGHT);
298 		m_setflags |= widthWasSet;
299 	}
300 	if (m_widthIndex < 0)
301 	{
302 		m_weightIndex = 0;
303 		m_slantIndex = 1;
304 		m_widthIndex = 2;
305 	}
306 }
307 
setWidth(const QString & newWidth)308 void gtFont::setWidth(const QString& newWidth)
309 {
310 	m_width = newWidth;
311 	m_useFullName = false;
312 	m_setflags &= ~widthWasSet;
313 	if (!newWidth.isEmpty())
314 	{
315 		if (m_weight == fontWeights[REGULAR])
316 			setWeight(NO_WEIGHT);
317 		else if (m_weight == fontWeights[ROMAN])
318 			setWeight(NO_WEIGHT);
319 		m_setflags |= widthWasSet;
320 	}
321 	if (m_widthIndex < 0)
322 	{
323 		m_weightIndex = 0;
324 		m_slantIndex = 1;
325 		m_widthIndex = 2;
326 	}
327 }
328 
getWidth()329 QString gtFont::getWidth()
330 {
331 	return m_width;
332 }
333 
setSize(int newSize)334 void gtFont::setSize(int newSize)
335 {
336 	m_size = newSize;
337 	m_setflags |= sizeWasSet;
338 }
339 
setSize(double newSize)340 void gtFont::setSize(double newSize)
341 {
342 	m_size = static_cast<int>(newSize);
343 	m_setflags |= sizeWasSet;
344 }
345 
setColor(const QString & newColor)346 void gtFont::setColor(const QString& newColor)
347 {
348 	m_color = newColor;
349 	m_setflags |= fillColorWasSet;
350 }
351 
setShade(int newShade)352 void gtFont::setShade(int newShade)
353 {
354 	m_shade = newShade;
355 	m_setflags |= fillShadeWasSet;
356 }
357 
setStrokeColor(const QString & newColor)358 void gtFont::setStrokeColor(const QString& newColor)
359 {
360 	m_strokeColor = newColor;
361 	m_setflags |= strokeColorWasSet;
362 }
363 
setStrokeShade(int newShade)364 void gtFont::setStrokeShade(int newShade)
365 {
366 	m_strokeShade = newShade;
367 	m_setflags |= strokeShadeWasSet;
368 }
369 
getName()370 QString gtFont::getName()
371 {
372 	if (m_useFullName)
373 		return m_name;
374 
375 	QString name2 = m_family + " ";
376 
377 	if (m_weightIndex == 0)
378 		name2 += m_weight + " ";
379 	else if (m_slantIndex == 0)
380 		name2 += m_slant + " ";
381 	else if (m_widthIndex == 0)
382 		name2 += m_width + " ";
383 
384 	if (m_weightIndex == 1)
385 		name2 += m_weight + " ";
386 	else if (m_slantIndex == 1)
387 		name2 += m_slant + " ";
388 	else if (m_widthIndex == 1)
389 		name2 += m_width + " ";
390 
391 	if (m_weightIndex == 2)
392 		name2 += m_weight + " ";
393 	else if (m_slantIndex == 2)
394 		name2 += m_slant + " ";
395 	else if (m_widthIndex == 2)
396 		name2 += m_width + " ";
397 
398 	name2 += m_append;
399 	name2 = name2.simplified();
400 	return name2;
401 }
402 
getName(uint i)403 QString gtFont::getName(uint i)
404 {
405 	QString fname = m_family + " ";
406 	switch (i)
407 	{
408 		case 0:
409 			fname = fname + m_weight + " " + m_slant + " " + m_width + " " + m_append;
410 			break;
411 		case 1:
412 			fname = fname + m_weight + " " + m_width + " " + m_slant + " " + m_append;
413 			break;
414 		case 2:
415 			fname = fname + m_slant + " " + m_weight + " " + m_width + " " + m_append;
416 			break;
417 		case 3:
418 			fname = fname + m_slant + " " + m_width + " " + m_weight + " " + m_append;
419 			break;
420 		case 4:
421 			fname = fname + m_width + " " + m_weight + " " + m_slant + " " + m_append;
422 			break;
423 		case 5:
424 			fname = fname + m_width + " " + m_slant + " " + m_weight + " " + m_append;
425 			break;
426 		case 6:
427 			fname = fname + " " + m_append + " " + m_weight + " " + m_slant + " " + m_width;
428 			break;
429 		case 7:
430 			fname = fname + " " + m_append + " " + m_weight + " " + m_width + " " + m_slant;
431 			break;
432 		case 8:
433 			fname = fname + " " + m_append + " " + m_slant + " " + m_weight + " " + m_width;
434 			break;
435 		case 9:
436 			fname = fname + " " + m_append + " " + m_slant + " " + m_width + " " + m_weight;
437 			break;
438 		case 10:
439 			fname = fname + " " + m_append + " " + m_width + " " + m_weight + " " + m_slant;
440 			break;
441 		case 11:
442 			fname = fname + " " + m_append + " " + m_width + " " + m_slant + " " + m_weight;
443 			break;
444 		case 12:
445 			if ((m_append.isEmpty()) && (m_weight.isEmpty()) && (m_slant.isEmpty()) && (m_width.isEmpty()))
446 				fname = fname + " " + fontWeights[REGULAR];
447 			break;
448 		case 13:
449 			if ((m_append.isEmpty()) && (m_weight.isEmpty()) && (m_slant.isEmpty()) && (m_width.isEmpty()))
450 				fname = fname + " " + fontWeights[ROMAN];
451 			break;
452 	}
453 	fname = fname.simplified();
454 	return fname;
455 }
456 
getSize()457 int gtFont::getSize()
458 {
459 	return m_size;
460 }
461 
getColor()462 QString gtFont::getColor()
463 {
464 	return m_color;
465 }
466 
getShade()467 int gtFont::getShade()
468 {
469 	return m_shade;
470 }
471 
getStrokeColor()472 QString gtFont::getStrokeColor()
473 {
474 	return m_strokeColor;
475 }
476 
getStrokeShade()477 int gtFont::getStrokeShade()
478 {
479 	return m_strokeShade;
480 }
481 
noEffects()482 void gtFont::noEffects()
483 {
484 	m_fontEffects[NORMAL]        = true;
485 	m_fontEffects[UNDERLINE]     = false;
486 	m_fontEffects[STRIKETHROUGH] = false;
487 	m_fontEffects[SMALL_CAPS]    = false;
488 	m_fontEffects[SUPERSCRIPT]   = false;
489 	m_fontEffects[SUBSCRIPT]     = false;
490 	m_fontEffects[OUTLINE]       = false;
491 	m_setflags &= ~effectWasSet;
492 }
493 
getHscale()494 int gtFont::getHscale()
495 {
496 	return m_hscale;
497 }
498 
setHscale(int newHscale)499 void gtFont::setHscale(int newHscale)
500 {
501 	m_hscale = newHscale;
502 	m_setflags |= hscaleWasSet;
503 }
504 
getKerning()505 int gtFont::getKerning()
506 {
507 	return m_kerning;
508 }
509 
setKerning(int newKerning)510 void gtFont::setKerning(int newKerning)
511 {
512 	m_kerning = newKerning;
513 	m_setflags |= kerningWasSet;
514 }
515 
parseName()516 void gtFont::parseName()
517 {
518 	m_smallestIndex = -1;
519 	m_biggestIndex = - 1;
520 	m_index = -1;
521 	m_tmpWeightIndex = -1;
522 	m_tmpSlantIndex = -1;
523 	m_tmpWidthIndex = -1;
524 	parseWeight();
525 	parseSlant();
526 	parseWidth();
527 	parseFamily();
528 }
529 
parseWeight()530 void gtFont::parseWeight()
531 {
532 	bool found = false;
533 	for (int i = 1; i < FontWeightMAX; ++i)
534 	{
535 		m_index = m_name.indexOf(fontWeights[i]); // f.e. Demi Bold
536 		QString tmpWeight = "";
537 		if ((m_index == -1) && (fontWeights[i].indexOf(" ") != -1) && (fontWeights[i].indexOf(" ") != 1))
538 		{
539 			QString fw2 = fontWeights[i];
540 			fw2.replace(" ", "-"); // f.e. Demi-Bold
541 			m_index = m_name.indexOf(fw2);
542 			if (m_index == -1)
543 			{
544 				fw2 = fontWeights[i];
545 				fw2.replace(" ", ""); // f.e. DemiBold
546 				m_index = m_name.indexOf(fw2);
547 				if (m_index == -1)
548 				{
549 					fw2 = fontWeights[i];
550 					fw2.replace(" B", " b"); // f.e. Demibold
551 					fw2.replace(" C", " c");
552 					fw2.replace(" H", " h");
553 					fw2.replace(" L", " l");
554 					fw2.replace(" ", "");
555 					m_index = m_name.indexOf(fw2);
556 					if (m_index != -1)
557 						tmpWeight = fw2;
558 				}
559 				else
560 					tmpWeight = fw2;
561 			}
562 			else
563 			{
564 				tmpWeight = fw2;
565 			}
566 		}
567 		else
568 			tmpWeight = fontWeights[i];
569 		if (m_index != -1)
570 		{
571 			m_weight = tmpWeight;
572 			if (m_smallestIndex == -1 || m_smallestIndex > m_index)
573 				m_smallestIndex = m_index;
574 			if ((m_biggestIndex == -1) || (m_biggestIndex < m_index + static_cast<int>(tmpWeight.length()) - 1))
575 				m_biggestIndex = m_index + tmpWeight.length();
576 			found = true;
577 			m_tmpWeightIndex = m_index;
578 			break;
579 		}
580 	}
581 	if (!found)
582 		m_weight = fontWeights[NO_WEIGHT];
583 }
584 
parseSlant()585 void gtFont::parseSlant()
586 {
587 	bool found = false;
588 	for (int i = 1; i < FontSlantMAX; ++i)
589 	{
590 		m_index = m_name.indexOf(fontSlants[i]);
591 		if (m_index != -1)
592 		{
593 			m_slant = fontSlants[i];
594 			if (m_smallestIndex == -1 || m_smallestIndex > m_index)
595 				m_smallestIndex = m_index;
596 			if ((m_biggestIndex == -1) || (m_biggestIndex < m_index + static_cast<int>(m_slant.length()) - 1))
597 				m_biggestIndex = m_index + m_slant.length();
598 			found = true;
599 			m_tmpSlantIndex = m_index;
600 			break;
601 		}
602 	}
603 	if (!found)
604 		m_slant = fontSlants[NO_SLANT];
605 }
606 
parseWidth()607 void gtFont::parseWidth()
608 {
609 	bool found = false;
610 	for (int i = 1; i < FontWidthMAX; ++i)
611 	{
612 		m_index = m_name.indexOf(fontWidths[i]);
613 		QString tmpWidth = "";
614 		if ((m_index == -1) && (fontWidths[i].indexOf(" ") != -1) && (fontWidths[i].indexOf(" ") != 1))
615 		{
616 			QString fw2 = fontWidths[i];
617 			fw2.replace(" ", "-");
618 			m_index = m_name.indexOf(fw2);
619 			if (m_index == -1)
620 			{
621 				fw2 = fontWidths[i];
622 				fw2.replace(" ", "");
623 				m_index = m_name.indexOf(fw2);
624 				if (m_index == -1)
625 				{
626 					fw2 = fontWidths[i];
627 					fw2.replace(" B", " b");
628 					fw2.replace(" C", " c");
629 					fw2.replace(" H", " h");
630 					fw2.replace(" L", " l");
631 					fw2.replace(" ", "");
632 					m_index = m_name.indexOf(fw2);
633 					if (m_index != -1)
634 						tmpWidth = fw2;
635 				}
636 				else
637 					tmpWidth = fw2;
638 			}
639 			else
640 			{
641 				tmpWidth = fw2;
642 			}
643 		}
644 		else
645 			tmpWidth = fontWidths[i];
646 		if (m_index != -1)
647 		{
648 			m_width = tmpWidth;
649 			if (m_smallestIndex == -1 || m_smallestIndex > m_index)
650 				m_smallestIndex = m_index;
651 			if ((m_biggestIndex == -1) || (m_biggestIndex < m_index + static_cast<int>(tmpWidth.length()) - 1))
652 				m_biggestIndex = m_index + tmpWidth.length();
653 			found = true;
654 			m_tmpWidthIndex = m_index;
655 			break;
656 		}
657 	}
658 	if (!found)
659 		m_width = fontWidths[NO_WIDTH];
660 }
661 
parseFamily()662 void gtFont::parseFamily()
663 {
664 	if (m_tmpWeightIndex < m_tmpSlantIndex)
665 	{
666 		m_weightIndex = 0;
667 		m_slantIndex  = 1;
668 		if (m_tmpWidthIndex < m_tmpWeightIndex)
669 		{
670 			m_widthIndex = 0;
671 			m_weightIndex = 1;
672 			m_slantIndex = 2;
673 		}
674 		else if (m_tmpWidthIndex < m_tmpSlantIndex)
675 		{
676 			m_widthIndex = 1;
677 			m_slantIndex = 2;
678 		}
679 		else
680 			m_widthIndex = 2;
681 	}
682 	else if (m_tmpWeightIndex > m_tmpSlantIndex)
683 	{
684 		m_slantIndex = 0;
685 		m_weightIndex = 1;
686 		if (m_tmpWidthIndex < m_tmpSlantIndex)
687 		{
688 			m_widthIndex = 0;
689 			m_slantIndex = 1;
690 			m_weightIndex = 2;
691 		}
692 		else if (m_tmpWidthIndex < m_tmpWeightIndex)
693 		{
694 			m_widthIndex = 1;
695 			m_weightIndex = 2;
696 		}
697 		else
698 			m_widthIndex = 2;
699 	}
700 	else
701 	{
702 		m_weightIndex = -2;
703 		m_widthIndex = -1;
704 		m_slantIndex = 0;
705 	}
706 
707 	if (m_smallestIndex == -1)
708 		m_family = m_name;
709 	else
710 		m_family = m_name.left(m_smallestIndex);
711 	if (m_biggestIndex == -1 || m_biggestIndex >= m_name.length())
712 		m_append = "";
713 	else
714 		m_append = m_name.right(m_name.length() - m_biggestIndex - 1);
715 	m_family = m_family.trimmed();
716 }
717 
find(const QString & where,const QString & what)718 int gtFont::find(const QString& where, const QString& what)
719 {
720 	QString realWhat = " " + what;
721 	int index = where.lastIndexOf(realWhat); // f.e. Demi Bold
722 	if (index != -1)
723 	{
724 		if (index + realWhat.length() != where.length())
725 			if (where[index + realWhat.length() + 1] != ' ')
726 				index = -1;
727 	}
728 	return index;
729 }
730 
~gtFont()731 gtFont::~gtFont()
732 {
733 
734 }
735