src/gui/text/qfontengine_ft.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    92 #else
    92 #else
    93 #define X_SIZE(face,i) ((face)->available_sizes[i].width << 6)
    93 #define X_SIZE(face,i) ((face)->available_sizes[i].width << 6)
    94 #define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
    94 #define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
    95 #endif
    95 #endif
    96 
    96 
       
    97 /* FreeType 2.1.10 starts to provide FT_GlyphSlot_Embolden */
       
    98 #if (FREETYPE_MAJOR*10000+FREETYPE_MINOR*100+FREETYPE_PATCH) >= 20110
       
    99 #define Q_FT_GLYPHSLOT_EMBOLDEN(slot)   FT_GlyphSlot_Embolden(slot)
       
   100 #else
       
   101 #define Q_FT_GLYPHSLOT_EMBOLDEN(slot)
       
   102 #endif
       
   103 
    97 #define FLOOR(x)    ((x) & -64)
   104 #define FLOOR(x)    ((x) & -64)
    98 #define CEIL(x)	    (((x)+63) & -64)
   105 #define CEIL(x)	    (((x)+63) & -64)
    99 #define TRUNC(x)    ((x) >> 6)
   106 #define TRUNC(x)    ((x) >> 6)
   100 #define ROUND(x)    (((x)+32) & -64)
   107 #define ROUND(x)    (((x)+32) & -64)
   101 
   108 
   792         g->uploadedToServer = false;
   799         g->uploadedToServer = false;
   793         g->data = 0;
   800         g->data = 0;
   794     }
   801     }
   795 
   802 
   796     FT_GlyphSlot slot = face->glyph;
   803     FT_GlyphSlot slot = face->glyph;
   797     if (embolden) FT_GlyphSlot_Embolden(slot);
   804     if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
   798     int left  = slot->metrics.horiBearingX;
   805     int left  = slot->metrics.horiBearingX;
   799     int right = slot->metrics.horiBearingX + slot->metrics.width;
   806     int right = slot->metrics.horiBearingX + slot->metrics.width;
   800     int top    = slot->metrics.horiBearingY;
   807     int top    = slot->metrics.horiBearingY;
   801     int bottom = slot->metrics.horiBearingY - slot->metrics.height;
   808     int bottom = slot->metrics.horiBearingY - slot->metrics.height;
   802     if(transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics
   809     if(transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics
   938 
   945 
   939     if (set->outline_drawing && fetchMetricsOnly)
   946     if (set->outline_drawing && fetchMetricsOnly)
   940         return 0;
   947         return 0;
   941 
   948 
   942     FT_GlyphSlot slot = face->glyph;
   949     FT_GlyphSlot slot = face->glyph;
   943     if (embolden) FT_GlyphSlot_Embolden(slot);
   950     if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
   944     FT_Library library = qt_getFreetype();
   951     FT_Library library = qt_getFreetype();
   945 
   952 
   946     info.xOff = TRUNC(ROUND(slot->advance.x));
   953     info.xOff = TRUNC(ROUND(slot->advance.x));
   947     info.yOff = 0;
   954     info.yOff = 0;
   948 
   955 
  1556     int glyph_pos = 0;
  1563     int glyph_pos = 0;
  1557     if (freetype->symbol_map) {
  1564     if (freetype->symbol_map) {
  1558         FT_Face face = freetype->face;
  1565         FT_Face face = freetype->face;
  1559         for ( int i = 0; i < len; ++i ) {
  1566         for ( int i = 0; i < len; ++i ) {
  1560             unsigned int uc = getChar(str, i, len);
  1567             unsigned int uc = getChar(str, i, len);
  1561             if (mirrored)
       
  1562                 uc = QChar::mirroredChar(uc);
       
  1563             glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
  1568             glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
  1564             if ( !glyphs->glyphs[glyph_pos] ) {
  1569             if ( !glyphs->glyphs[glyph_pos] ) {
  1565                 glyph_t glyph;
  1570                 glyph_t glyph;
  1566 #if !defined(QT_NO_FONTCONFIG)
  1571 #if !defined(QT_NO_FONTCONFIG)
  1567                 if (!mtx) {
  1572                 if (!mtx) {