/branches/Version133x/Scribus/scribus/pdflib.cpp |
---|
980,11 → 980,11 |
else */ |
// { |
GListeInd glyphIndexes; |
struct GlNamInd glIndexName; |
GlyphsIdxOfFont.insert(it.key(), glyphIndexes); |
QMap<uint,uint> glUniToIndex; |
QMap<uint, GlNamInd> glIndexToNames; |
QMap<uint,std::pair<uint,QString> > gl; |
GlyNames2(AllFonts[it.key()], &gl); |
GlyMaps(AllFonts[it.key()], &glUniToIndex, &gl); |
int nglyphs = 0; |
QMap<uint,std::pair<uint,QString> >::Iterator gli; |
for (gli = gl.begin(); gli != gl.end(); ++gli) |
1011,7 → 1011,7 |
PutDoc(QString::number(static_cast<int>(AllFonts[it.key()]->CharWidth[gl[glyph].first] * 1000))+" "); |
glIndexName.Code = chCount + Fc * 256; |
glIndexName.Name = "/" + gl[glyph].second; |
glyphIndexes[gl[glyph].first] = glIndexName; |
glIndexToNames[glyph] = glIndexName; |
} |
else |
PutDoc("0 "); |
1116,6 → 1116,9 |
Seite.FObjects["Fo"+QString::number(a)+"S"+QString::number(Fc)] = ObjCounter; |
ObjCounter++; |
} // for(Fc) |
GListeInd glyphIndexes; |
glyphIndexes.uniToIndex = glUniToIndex; |
glyphIndexes.indexToNames = glIndexToNames; |
GlyphsIdxOfFont.insert(it.key(), glyphIndexes); |
StartObj(ObjCounter); |
PutDoc("[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "); |
3440,9 → 3443,16 |
chx = out2.mid(d-za2, 1); |
} |
uint cc = chx[0].unicode(); |
uint idx = 0; |
if (GlyphsIdxOfFont[hl->cfont->scName()].contains(cc)) |
idx = GlyphsIdxOfFont[hl->cfont->scName()][cc].Code; |
uint idx = 0, ind; |
const GListeInd& listIndexes = GlyphsIdxOfFont[hl->cfont->scName()]; |
QMap<uint, uint>::ConstIterator itl = listIndexes.uniToIndex.find(cc); |
if (itl != listIndexes.uniToIndex.end()) |
{ |
ind = itl.data(); |
QMap<uint, GlNamInd>::ConstIterator itx = listIndexes.indexToNames.find(ind); |
if( itx != listIndexes.indexToNames.end()) |
idx = itx.data().Code; |
} |
uint idx1 = (idx >> 8) & 0xFF; |
if (hl->cstyle & 32) |
{ |
3594,10 → 3604,16 |
} |
else |
{ |
cc = chx[0].unicode(); |
cc = chx[0].unicode(); |
idx = 0; |
if (GlyphsIdxOfFont[hl->cfont->scName()].contains(cc)) |
idx = GlyphsIdxOfFont[hl->cfont->scName()][cc].Code; |
itl = listIndexes.uniToIndex.find(cc); |
if (itl != listIndexes.uniToIndex.end()) |
{ |
ind = itl.data(); |
QMap<uint, GlNamInd>::ConstIterator itx = listIndexes.indexToNames.find(ind); |
if( itx != listIndexes.indexToNames.end()) |
idx = itx.data().Code; |
} |
idx1 = (idx >> 8) & 0xFF; |
tmp += UsedFontsP[hl->cfont->scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n"; |
if (hl->cstroke != CommonStrings::None) |
3651,10 → 3667,16 |
double wtr = Cwidth(&doc, hl->cfont, chx, chs) * (hl->cscale / 1000.0); |
tmp += "1 0 0 1 "+FToStr(hl->xp+wtr)+" "+FToStr(-hl->yp+(hl->csize / 10.0) * (hl->cbase / 1000.0))+" Tm\n"; |
chx = "-"; |
cc = chx[0].unicode(); |
cc = chx[0].unicode(); |
idx = 0; |
if (GlyphsIdxOfFont[hl->cfont->scName()].contains(cc)) |
idx = GlyphsIdxOfFont[hl->cfont->scName()][cc].Code; |
itl = listIndexes.uniToIndex.find(cc); |
if (itl != listIndexes.uniToIndex.end()) |
{ |
ind = itl.data(); |
QMap<uint, GlNamInd>::ConstIterator itx = listIndexes.indexToNames.find(ind); |
if( itx != listIndexes.indexToNames.end()) |
idx = itx.data().Code; |
} |
idx1 = (idx >> 8) & 0xFF; |
tmp += UsedFontsP[hl->cfont->scName()]+"S"+QString::number(idx1)+" "+FToStr(tsz / 10.0)+" Tf\n"; |
idx2 = idx & 0xFF; |
/branches/Version133x/Scribus/scribus/pdflib.h |
---|
68,7 → 68,10 |
}; |
private: |
typedef QMap<uint, GlNamInd> GListeInd; |
typedef struct { |
QMap<uint, uint> uniToIndex; |
QMap<uint, GlNamInd> indexToNames; |
} GListeInd; |
bool PDF_Begin_Doc(const QString& fn, SCFonts &AllFonts, QMap<QString,int> DocFonts, BookMView* vi); |
void PDF_Begin_Page(const Page* pag, QPixmap pm = 0); |
/branches/Version133x/Scribus/scribus/scfontmetrics.h |
---|
27,9 → 27,9 |
FPointArray SCRIBUS_API traceChar(FT_Face face, uint chr, int chs, double *x, double *y, bool *err); |
QPixmap SCRIBUS_API FontSample(Foi * fnt, int s, QString ts, QColor back, bool force = false); |
QPixmap SCRIBUS_API fontSamples(Foi * fnt, int s, QString ts, QColor back); |
bool SCRIBUS_API GlyNames(Foi * fnt, QMap<uint, QString> *GList); |
bool SCRIBUS_API GlyNames2(Foi * fnt, QMap<uint, std::pair<uint, QString> > *GListInd); |
bool SCRIBUS_API GlyIndex(Foi * fnt, QMap<uint, PDFlib::GlNamInd> *GListInd); |
bool SCRIBUS_API GlyNames(Foi * fnt, QMap<uint, QString> *GList); |
bool SCRIBUS_API GlyIndex(Foi * fnt, QMap<uint, PDFlib::GlNamInd> *GListInd); |
bool SCRIBUS_API GlyMaps (Foi * fnt, QMap<uint, uint> *GUniToIndex, QMap<uint, std::pair<uint, QString> > *GIndexToNames); |
double SCRIBUS_API Cwidth(ScribusDoc *currentDoc, Foi* name, QString ch, int Siz, QString ch2 = " "); |
double SCRIBUS_API RealCWidth(ScribusDoc *currentDoc, Foi* name, QString ch, int Siz); |
double SCRIBUS_API RealCAscent(ScribusDoc *currentDoc, Foi* name, QString ch, int Size); |
/branches/Version133x/Scribus/scribus/scfontmetrics.cpp |
---|
340,8 → 340,9 |
return true; |
} |
bool GlyNames2(Foi * fnt, QMap<uint, std::pair<uint, QString> > *GListInd) |
bool GlyIndex(Foi * fnt, QMap<uint, PDFlib::GlNamInd> *GListInd) |
{ |
struct PDFlib::GlNamInd gln; |
bool error; |
char buf[50]; |
FT_Library library; |
348,6 → 349,8 |
FT_Face face; |
FT_ULong charcode; |
FT_UInt gindex; |
uint counter1 = 32; |
uint counter2 = 0; |
error = FT_Init_FreeType(&library); |
error = FT_New_Face(library, fnt->fontFilePath(), fnt->faceIndex(), &face); |
setBestEncoding(face); |
360,24 → 363,31 |
{ |
bool notfound = true; |
if (hasPSNames) |
notfound = FT_Get_Glyph_Name(face, gindex, &buf, 50); |
notfound = FT_Get_Glyph_Name(face, gindex, buf, 50); |
// just in case FT gives empty string or ".notdef" |
// no valid glyphname except ".notdef" starts with '.' |
if (notfound || buf[0] == '\0' || buf[0] == '.') |
GListInd->insert(gindex, std::make_pair(static_cast<uint>(charcode),adobeGlyphName(charcode)), false); |
gln.Name = "/" + adobeGlyphName(charcode); |
else |
GListInd->insert(gindex, std::make_pair(static_cast<uint>(charcode),QString(reinterpret_cast<char*>(buf))), false); |
gln.Name = "/" + QString(buf); |
gln.Code = counter1 + counter2; |
GListInd->insert(charcode, gln); |
charcode = FT_Get_Next_Char(face, charcode, &gindex ); |
counter1++; |
if (counter1 > 255) |
{ |
counter1 = 32; |
counter2 += 0x100; |
} |
} |
FT_Done_FreeType( library ); |
return true; |
} |
bool GlyIndex(Foi * fnt, QMap<uint, PDFlib::GlNamInd> *GListInd) |
bool GlyMaps(Foi * fnt, QMap<uint, uint> *GUniToIndex, QMap<uint, std::pair<uint, QString> > *GIndexToNames) |
{ |
struct PDFlib::GlNamInd gln; |
bool error; |
char buf[50]; |
FT_Library library; |
384,8 → 394,6 |
FT_Face face; |
FT_ULong charcode; |
FT_UInt gindex; |
uint counter1 = 32; |
uint counter2 = 0; |
error = FT_Init_FreeType(&library); |
error = FT_New_Face(library, fnt->fontFilePath(), fnt->faceIndex(), &face); |
setBestEncoding(face); |
398,24 → 406,18 |
{ |
bool notfound = true; |
if (hasPSNames) |
notfound = FT_Get_Glyph_Name(face, gindex, buf, 50); |
notfound = FT_Get_Glyph_Name(face, gindex, &buf, 50); |
GUniToIndex->insert(charcode, gindex); |
// just in case FT gives empty string or ".notdef" |
// no valid glyphname except ".notdef" starts with '.' |
if (notfound || buf[0] == '\0' || buf[0] == '.') |
gln.Name = "/" + adobeGlyphName(charcode); |
GIndexToNames->insert(gindex, std::make_pair(static_cast<uint>(charcode),adobeGlyphName(charcode)), false); |
else |
gln.Name = "/" + QString(buf); |
gln.Code = counter1 + counter2; |
GListInd->insert(charcode, gln); |
GIndexToNames->insert(gindex, std::make_pair(static_cast<uint>(charcode),QString(reinterpret_cast<char*>(buf))), false); |
charcode = FT_Get_Next_Char(face, charcode, &gindex ); |
counter1++; |
if (counter1 > 255) |
{ |
counter1 = 32; |
counter2 += 0x100; |
} |
} |
FT_Done_FreeType( library ); |
return true; |