r19661 by jghali - some code style cleanup for scfontmetrics.cpp + change to ease debugging
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 13 20:48:48 UTC 2014
Author: jghali
Date: Sat Dec 13 20:48:47 2014
New Revision: 19661
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19661
Log:
some code style cleanup for scfontmetrics.cpp + change to ease debugging
Modified:
branches/Version14x/Scribus/scribus/fonts/scfontmetrics.cpp
Modified: branches/Version14x/Scribus/scribus/fonts/scfontmetrics.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19661&path=/branches/Version14x/Scribus/scribus/fonts/scfontmetrics.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/fonts/scfontmetrics.cpp (original)
+++ branches/Version14x/Scribus/scribus/fonts/scfontmetrics.cpp Sat Dec 13 20:48:47 2014
@@ -72,21 +72,21 @@
int defaultchmap = 0;
for(int u = 0; u < face->num_charmaps; u++)
{
- if (face->charmaps[u]->encoding == FT_ENCODING_UNICODE )
- {
- FT_Set_Charmap(face, face->charmaps[u]);
+ FT_CharMap charmap = face->charmaps[u];
+ if (charmap->encoding == FT_ENCODING_UNICODE)
+ {
+ FT_Set_Charmap(face, charmap);
chmapUniCode = u;
gindex = 0;
- charcode = FT_Get_First_Char( face, &gindex );
+ charcode = FT_Get_First_Char(face, &gindex);
while ( gindex != 0 )
{
countUniCode++;
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
+ charcode = FT_Get_Next_Char(face, charcode, &gindex);
}
// qDebug() << "found Unicode enc for" << face->family_name << face->style_name << "as map" << chmapUniCode << "with" << countUniCode << "glyphs";
-
- }
- if (face->charmaps[u]->encoding == FT_ENCODING_ADOBE_CUSTOM)
+ }
+ if (charmap->encoding == FT_ENCODING_ADOBE_CUSTOM)
{
chmapCustom = u;
foundEncoding = true;
@@ -94,7 +94,7 @@
// qDebug() << "found Custom enc for" << face->family_name << face->style_name;
break;
}
- else if (face->charmaps[u]->encoding == FT_ENCODING_MS_SYMBOL)
+ else if (charmap->encoding == FT_ENCODING_MS_SYMBOL)
{
// qDebug() << "found Symbol enc for" << face->family_name << face->style_name;
@@ -104,59 +104,52 @@
break;
}
}
- int mapToSet=defaultchmap;
+ int mapToSet = defaultchmap;
if (chmapUniCode >= 0 && countUniCode >= face->num_glyphs-1)
{
// qDebug() << "using Unicode enc for" << face->family_name << face->style_name;
-
- mapToSet=chmapUniCode;
- //FT_Set_Charmap(face, face->charmaps[chmapUniCode]);
+ mapToSet = chmapUniCode;
retVal = 0;
}
+ else if (foundEncoding)
+ {
+// qDebug() << "using special enc for" << face->family_name << face->style_name;
+ mapToSet = chmapCustom;
+ }
else
- if (foundEncoding)
- {
-// qDebug() << "using special enc for" << face->family_name << face->style_name;
- mapToSet=chmapCustom;
- //FT_Set_Charmap(face, face->charmaps[chmapCustom]);
- }
- else
{
// qDebug() << "using default enc for" << face->family_name << face->style_name;
- mapToSet=defaultchmap;
- //FT_Set_Charmap(face, defaultEncoding);
+ mapToSet = defaultchmap;
retVal = 0;
}
//Fixes #2199, missing glyphs from 1.2.1->1.2.2
//If the currently wanted character map is not already Unicode...
//if (FT_Get_Charmap_Index(face->charmap)!=chmapUniCode)
- if (mapToSet!=chmapUniCode)
+ if (mapToSet != chmapUniCode)
{
//Change map so we can count the chars in it
FT_Set_Charmap(face, face->charmaps[mapToSet]);
//Count the characters in the current map
gindex = 0;
- int countCurrMap=0;
- charcode = FT_Get_First_Char( face, &gindex );
- while ( gindex != 0 )
+ int countCurrMap = 0;
+ charcode = FT_Get_First_Char(face, &gindex);
+ while (gindex != 0)
{
countCurrMap++;
- charcode = FT_Get_Next_Char( face, charcode, &gindex );
+ charcode = FT_Get_Next_Char(face, charcode, &gindex);
}
//If the last Unicode map we found before has more characters,
//then set it to be the current map.
- if (countUniCode>countCurrMap)
+ if (countUniCode > countCurrMap)
{
// qDebug() << "override with Unicode enc for" << face->family_name << face->style_name << "map" << mapToSet << "has only" << countCurrMap << "glyphs";
- mapToSet=chmapUniCode;
- //FT_Set_Charmap(face, face->charmaps[chmapUniCode]);
+ mapToSet = chmapUniCode;
retVal = 0;
}
}
-// if (face->charmap == NULL || mapToSet!=FT_Get_Charmap_Index(face->charmap))
- FT_Set_Charmap(face, face->charmaps[mapToSet]);
+ FT_Set_Charmap(face, face->charmaps[mapToSet]);
// qDebug() << "set map" << mapToSet << "for" << face->family_name << face->style_name;
// qDebug() << "glyphsForNumbers 0-9:" << FT_Get_Char_Index(face, QChar('0').unicode())
// << FT_Get_Char_Index(face, QChar('1').unicode()) << FT_Get_Char_Index(face, QChar('2').unicode()) << FT_Get_Char_Index(face, QChar('3').unicode())
More information about the scribus-commit
mailing list