00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <ft2build.h>
00020 #include FT_SYNTHESIS_H
00021 #include FT_INTERNAL_DEBUG_H
00022 #include FT_INTERNAL_OBJECTS_H
00023 #include FT_OUTLINE_H
00024 #include FT_BITMAP_H
00025
00026
00027
00028
00029
00030
00031
00032
00033 #undef FT_COMPONENT
00034 #define FT_COMPONENT trace_synth
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 FT_EXPORT_DEF( void )
00047 FT_GlyphSlot_Oblique( FT_GlyphSlot slot )
00048 {
00049 FT_Matrix transform;
00050 FT_Outline* outline = &slot->outline;
00051
00052
00053
00054 if ( slot->format != FT_GLYPH_FORMAT_OUTLINE )
00055 return;
00056
00057
00058
00059
00060
00061
00062 transform.xx = 0x10000L;
00063 transform.yx = 0x00000L;
00064
00065 transform.xy = 0x06000L;
00066 transform.yy = 0x10000L;
00067
00068 FT_Outline_Transform( outline, &transform );
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 FT_EXPORT_DEF( void )
00084 FT_GlyphSlot_Embolden( FT_GlyphSlot slot )
00085 {
00086 FT_Library library = slot->library;
00087 FT_Face face = slot->face;
00088 FT_Error error;
00089 FT_Pos xstr, ystr;
00090
00091
00092 if ( slot->format != FT_GLYPH_FORMAT_OUTLINE &&
00093 slot->format != FT_GLYPH_FORMAT_BITMAP )
00094 return;
00095
00096
00097 xstr = FT_MulFix( face->units_per_EM,
00098 face->size->metrics.y_scale ) / 24;
00099 ystr = xstr;
00100
00101 if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
00102 {
00103
00104 (void)FT_Outline_Embolden( &slot->outline, xstr );
00105
00106
00107
00108 xstr = xstr * 2;
00109 ystr = xstr;
00110 }
00111 else if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
00112 {
00113
00114 xstr &= ~63;
00115 if ( xstr == 0 )
00116 xstr = 1 << 6;
00117 ystr &= ~63;
00118
00119
00120
00121
00122
00123
00124
00125 if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
00126 {
00127 FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
00128 FT_TRACE1(( "too strong embolding parameter ystr=%d\n", ystr ));
00129 return;
00130 }
00131 error = FT_GlyphSlot_Own_Bitmap( slot );
00132 if ( error )
00133 return;
00134
00135 error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr );
00136 if ( error )
00137 return;
00138 }
00139
00140 if ( slot->advance.x )
00141 slot->advance.x += xstr;
00142
00143 if ( slot->advance.y )
00144 slot->advance.y += ystr;
00145
00146 slot->metrics.width += xstr;
00147 slot->metrics.height += ystr;
00148 slot->metrics.horiBearingY += ystr;
00149 slot->metrics.horiAdvance += xstr;
00150 slot->metrics.vertBearingX -= xstr / 2;
00151 slot->metrics.vertBearingY += ystr;
00152 slot->metrics.vertAdvance += ystr;
00153
00154
00155 if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
00156 slot->bitmap_top += (FT_Int)( ystr >> 6 );
00157 }
00158
00159
00160