Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Public Member Functions
ScFace_pfb Class Reference

#include <scface_ps.h>

Inheritance diagram for ScFace_pfb:
Inheritance graph
[legend]
Collaboration diagram for ScFace_pfb:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ScFace_pfb (QString fam, QString sty, QString alt, QString scname, QString psname, QString path, int face)
virtual bool EmbedFont (QString &str) const
virtual void load () const

Detailed Description

Definition at line 133 of file scface_ps.h.


Constructor & Destructor Documentation

ScFace_pfb::ScFace_pfb ( QString  fam,
QString  sty,
QString  alt,
QString  scname,
QString  psname,
QString  path,
int  face 
) [inline]

Definition at line 136 of file scface_ps.h.

                                                                                                                        :
              ScFace_postscript(fam,sty,alt,scname,psname,path,face)
              {
                     formatCode = ScFace::PFB;
              }

Member Function Documentation

virtual bool ScFace_pfb::EmbedFont ( QString &  str) const [inline, virtual]

Definition at line 142 of file scface_ps.h.

              {
                     QByteArray bb;
                     RawData(bb);
                     QString tmp2 = "";
                     if ((bb.size() > 2) &&  (bb[0] == char(0x80)) && (static_cast<int>(bb[1]) == 1))
                     {
                            QString tmp3="";
                            QString tmp4 = "";
                            uint posi,cxxc=0;
                            for (posi = 6; posi < bb.size(); ++posi)
                            {
                                   if ((bb[posi] == char(0x80)) && (posi+1 < bb.size()) && (static_cast<int>(bb[posi+1]) == 2))
                                          break;
                                   str += bb[posi];
                            }
                            uint ulen;
                            if (posi+6 < bb.size()) 
                            {
                                   ulen = bb[posi+2] & 0xff;
                                   ulen |= (bb[posi+3] << 8) & 0xff00;
                                   ulen |= (bb[posi+4] << 16) & 0xff0000;
                                   ulen |= (bb[posi+5] << 24) & 0xff000000;
                                   posi += 6;
                                   if (posi + ulen > bb.size())
                                          ulen = bb.size() - posi - 1;
                                   char linebuf[80];
                                   cxxc=0;
                                   for (uint j = 0; j < ulen; ++j)
                                   {
                                          unsigned char u=bb[posi];
                                          linebuf[cxxc]=((u >> 4) & 15) + '0';
                                          if(u>0x9f) linebuf[cxxc]+='a'-':';
                                          ++cxxc;
                                          u&=15; linebuf[cxxc]=u + '0';
                                          if(u>0x9) linebuf[cxxc]+='a'-':';
                                          ++posi;
                                          ++cxxc;
                                          if (cxxc > 72)
                                          {
                                                 linebuf[cxxc++]='\n';
                                                 linebuf[cxxc++]=0;
                                                 str += linebuf;
                                                 cxxc = 0;
                                          }
                                   }
                                   linebuf[cxxc]=0;
                                   str += linebuf;
                                   str += "\n";
                            }
                            posi += 6;
                            for (uint j = posi; j < bb.size(); ++j)
                            {
                                   if ((bb[j] == static_cast<char>(0x80)) && (j+1 < bb.size()) && (static_cast<int>(bb[j+1]) == 3))
                                          break;
                                   if(bb[j]=='\r')
                                          str+="\n";
                                   else
                                          str += bb[j];
                            }
                            str += "\n";
                            cxxc = 0;
                            return true;
                     }
                     else 
                     {
                            qDebug(QObject::tr("Font %1 cannot be read, no embedding").arg(fontFile));
                            return false;
                     }
              }

Here is the call graph for this function:

virtual void ScFace_postscript::load ( ) const [inline, virtual, inherited]

Definition at line 43 of file scface_ps.h.

              {
                     FtFace::load();
//                   bool error;
                     FT_Face face = ftFace();
                     if (!face)
                     {
                            const_cast<ScFace_postscript*>(this)->usable = false;
                            qDebug(QObject::tr("Font %1 is broken (no Face), discarding it").arg(fontFile));
                            return;
                     }
                     QString afnm = fontFile.left(fontFile.length()-3);
                     QFile afm(afnm+"afm");
                     if(!(afm.exists()))
                     {
                            afm.setName(afnm+"Afm");
                     }
                     if(!(afm.exists()))
                     {
                            afm.setName(afnm+"AFM");
                     }
                     if(!(afm.exists()))
                     {
                            afm.setName(afnm+"pfm");
                     }
                     if(!(afm.exists()))
                     {
                            afm.setName(afnm+"Pfm");
                     }
                     if(!(afm.exists())) {
                            afm.setName(afnm+"PFM");
                     }
                     if (afm.exists())
                     {
                            if(FT_Attach_File(face, afm.name()))
                                   qDebug(QObject::tr("Font %1 has broken metrics in file %2, ignoring metrics").arg(fontFile).arg(afm.name()));
                            else
                                   // re-initialize: ScFaceData::load() just clears caches,
                                   // FtFace::load() skips FT_New_Face if m_face is already defined.
                                   // dont mind checking glyphs again for now (PS files have only 255 glyphs max, anyway)
                                   FtFace::load();
                     }
//                   Ascent = tmp.setNum(face->ascender);
//                   Descender = tmp.setNum(face->descender);
//                   CapHeight = Ascent;
//                   ItalicAngle = "0";
//                   StdVW = "1";
//                   FontBBox = tmp.setNum(face->bbox.xMin)+" "+tmp2.setNum(face->bbox.yMin)+" "+tmp3.setNum(face->bbox.xMax)+" "+tmp4.setNum(face->bbox.yMax);
/*
 setBestEncoding(face);
                     gindex = 0;
                     charcode = FT_Get_First_Char( face, &gindex );
                     int goodGlyph = 0;
                     int invalidGlyph = 0;
                     while ( gindex != 0 )
                     {
                            error = FT_Load_Glyph( face, gindex, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP );
                            if (error)
                            {
                                   ++invalidGlyph;
                                   sDebug(QObject::tr("Font %1 has broken glyph %2 (charcode %3)").arg(fontPath()).arg(gindex).arg(charcode));
                                   charcode = FT_Get_Next_Char( face, charcode, &gindex );
                                   continue;
                            }
                            ++goodGlyph;
                            double ww = face->glyph->metrics.horiAdvance / uniEM;
                            if (face->glyph->format == FT_GLYPH_FORMAT_PLOTTER)
                                   isStroked = true;
                            error = false;
                            outlines = traceChar(face, charcode, 10, &x, &y, &error);
                            if (!error)
                            {
                                   CharWidth.insert(charcode, ww);
                                   GRec.Outlines = outlines.copy();
                                   GRec.x = x;
                                   GRec.y = y;
                                   GlyphArray.insert(charcode, GRec);
                            }
                            charcode = FT_Get_Next_Char( face, charcode, &gindex );
                     }
 */
              }

Here is the call graph for this function:


The documentation for this class was generated from the following file: