45 #include <private/qpainter_p.h> 46 #include <private/qpaintengine_raster_p.h> 47 #include <private/qpdf_p.h> 49 #include "private/qcore_unix_p.h" 55 #include "qplatformdefs.h" 60 #if !defined(Q_OS_INTEGRITY) 67 #include <sys/types.h> 77 # define MAP_FAILED (void *)-1 84 static inline unsigned int getChar(
const QChar *str,
int &i,
const int len)
87 if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
115 enum Flags { RendererOwnsData=0x01 };
122 metrics(m),
data(d) { }
178 }
else if ( g > max ) {
192 }
else if ( g > max ) {
197 return &glyph[g - min];
201 if ( !
this )
return 0;
206 if ( !
this )
return 0;
212 for (
int i=0; i<indent; i++) printf(
" ");
213 printf(
"%d..%d",min,max);
215 printf(
" (total %d)",totalChars());
217 if ( less ) less->
dump(indent+1);
218 if ( more ) more->
dump(indent+1);
240 min = (rw << 8) | cl;
243 max = (rw << 8) | cl;
265 for (
int i=0; i<n; i++) {
278 for (
int i=0; i<n; i++) {
282 glyph[i].
data =
data; data += datasize;
312 if (QT_FSTAT(fd, &st) != 0)
317 d->mmapLength = st.st_size;
321 d->mmapStart = (
uchar *)::mmap(0, st.st_size,
331 d->used_mmap =
false;
333 d->mmapStart =
new uchar[
d->mmapLength];
342 memcpy(reinterpret_cast<char*>(&
d->fm), data,
sizeof(
d->fm));
343 data +=
sizeof(
d->fm);
349 qDebug() <<
"font file" << fn
350 <<
"ascent" <<
d->fm.ascent <<
"descent" <<
d->fm.descent
351 <<
"leftbearing" <<
d->fm.leftbearing
352 <<
"rightbearing" <<
d->fm.rightbearing
353 <<
"maxwidth" <<
d->fm.maxwidth
354 <<
"leading" <<
d->fm.leading
355 <<
"flags" <<
d->fm.flags
356 <<
"underlinepos" <<
d->fm.underlinepos
357 <<
"underlinewidth" <<
d->fm.underlinewidth;
365 #if defined(QT_USE_MMAP) 367 ::munmap(
d->mmapStart,
d->mmapLength);
370 delete []
d->mmapStart;
386 for(
int i = 0; i < len; i++) {
387 unsigned int uc =
getChar(str, i, len);
390 glyphs->
glyphs[*nglyphs] = uc < 0x10000 ? uc : 0;
399 recalcAdvances(glyphs, flags);
406 for(
int i = 0; i < glyphs->
numGlyphs; i++) {
429 getGlyphPositions(si.
glyphs, matrix, si.
flags, glyphs, positions);
430 if (glyphs.
size() == 0)
433 int depth = (
d->fm.flags &
FM_SMOOTH) ? 8 : 1;
434 for(
int i = 0; i < glyphs.
size(); i++) {
435 const QPFGlyph *glyph =
d->tree->get(glyphs[i]);
467 for (
int j=0; j<256; ++j)
481 addBitmapFontToPath(x, y, glyphs, path, flags);
490 for (
int i = 0; i < glyphs.
numGlyphs; ++i)
492 return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
513 return d->fm.descent;
518 return d->fm.leading;
523 return d->fm.maxwidth;
533 for(
int i = 0; i < len; i++)
534 if (!
d->tree->inFont(str[i].
unicode()))
546 return d->fm.leftbearing;
551 return d->fm.rightbearing;
556 return d->fm.underlinepos;
561 return d->fm.underlinewidth;
564 #endif //QT_NO_QWS_QPF virtual QFixed leading() const
virtual QFixed underlinePosition() const
QPFGlyph * get(glyph_t g)
QPFGlyphTree(uchar *&data)
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
virtual bool canRender(const QChar *string, int len)
#define QT_END_NAMESPACE
This macro expands to.
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QPaintEngineState * state
virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const
QTransform transform() const
Returns the matrix in the current paint engine state.
void readMetrics(uchar *&data)
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)
virtual qreal minLeftBearing() const
virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si)
The QString class provides a Unicode character string.
static QFixed fromReal(qreal r)
virtual QFixed descent() const
The QChar class provides a 16-bit Unicode character.
Q_CORE_EXPORT void qDebug(const char *,...)
void readData(uchar *&data)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
bool inFont(glyph_t g) const
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
static const QCssKnownValue positions[NumKnownPositionModes - 1]
virtual QFixed ascent() const
QChar mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
QFontEngineQPF1(const QFontDef &, const QString &fn)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
QPFGlyph(QPFGlyphMetrics *m, uchar *d)
static unsigned int getChar(const QChar *str, int &i, const int len)
virtual Type type() const
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
void readNode(uchar *&data)
Q_CORE_EXPORT void qFatal(const char *,...)
void alphaPenBlt(const void *src, int bpl, int depth, int rx, int ry, int w, int h)
#define st(var, type, card)
QPFGlyphMetrics * metrics
int height() const
Returns the height.
if(void) toggleToolbarShown
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
QFixed effectiveAdvance(int item) const
The QPaintEngineState class provides information about the active paint engine's current state...
static QByteArray encodeName(const QString &fileName)
By default, this function converts fileName to the local 8-bit encoding determined by the user's loca...
The QSize class defines the size of a two-dimensional object using integer point precision.
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
virtual qreal minRightBearing() const
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual qreal maxCharWidth() const
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
virtual QImage alphaMapForGlyph(glyph_t)
virtual QFixed lineThickness() const