Lines Matching refs:glyph

161     virtual void generateAdvance(SkGlyph* glyph);
162 virtual void generateMetrics(SkGlyph* glyph);
163 virtual void generateImage(const SkGlyph& glyph);
164 virtual void generatePath(const SkGlyph& glyph, SkPath* path);
167 virtual SkUnichar generateGlyphToChar(uint16_t glyph);
181 void getBBoxForCurrentGlyph(SkGlyph* glyph, FT_BBox* bbox,
183 void updateGlyphIfLCD(SkGlyph* glyph);
345 advances[i] = face->glyph->advance.x;
372 FT_Outline_Get_CBox(&face->glyph->outline, bbox);
601 // using multiple font descriptions with a glyph ordering. Record
602 // the name of each glyph.
932 SkUnichar SkScalerContext_FreeType::generateGlyphToChar(uint16_t glyph) {
933 // iterate through each cmap entry, looking for matching glyph indices
938 if (glyphIndex == glyph) {
957 void SkScalerContext_FreeType::generateAdvance(SkGlyph* glyph) {
966 glyph->zeroMetrics();
973 error = FT_Get_Advance( fFace, glyph->getGlyphID(fBaseGlyphCount),
977 glyph->fRsbDelta = 0;
978 glyph->fLsbDelta = 0;
979 glyph->fAdvanceX = SkFixedMul(fMatrix22.xx, advance); // advance *2/3; //DEBUG
980 glyph->fAdvanceY = -SkFixedMul(fMatrix22.yx, advance);
985 /* otherwise, we need to load/hint the glyph, which is slower */
986 this->generateMetrics(glyph);
990 void SkScalerContext_FreeType::getBBoxForCurrentGlyph(SkGlyph* glyph,
994 FT_Outline_Get_CBox(&fFace->glyph->outline, bbox);
997 int dx = FixedToDot6(glyph->getSubXFixed());
998 int dy = FixedToDot6(glyph->getSubYFixed());
1016 // glyph image.
1019 vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.horiBearingX;
1020 vector.y = -fFace->glyph->metrics.vertBearingY - fFace->glyph->metrics.horiBearingY;
1029 void SkScalerContext_FreeType::updateGlyphIfLCD(SkGlyph* glyph) {
1031 glyph->fWidth += gLCDExtra;
1032 glyph->fLeft -= gLCDExtra >> 1;
1036 void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
1039 glyph->fRsbDelta = 0;
1040 glyph->fLsbDelta = 0;
1048 err = FT_Load_Glyph( fFace, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags );
1050 SkDEBUGF(("SkScalerContext_FreeType::generateMetrics(%x): FT_Load_Glyph(glyph:%d flags:%d) returned 0x%x\n",
1051 fFaceRec->fFontID, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags, err));
1053 glyph->zeroMetrics();
1059 switch ( fFace->glyph->format ) {
1063 if (0 == fFace->glyph->outline.n_contours) {
1064 glyph->fWidth = 0;
1065 glyph->fHeight = 0;
1066 glyph->fTop = 0;
1067 glyph->fLeft = 0;
1072 emboldenOutline(&fFace->glyph->outline);
1075 getBBoxForCurrentGlyph(glyph, &bbox, true);
1077 glyph->fWidth = SkToU16((bbox.xMax - bbox.xMin) >> 6);
1078 glyph->fHeight = SkToU16((bbox.yMax - bbox.yMin) >> 6);
1079 glyph->fTop = -SkToS16(bbox.yMax >> 6);
1080 glyph->fLeft = SkToS16(bbox.xMin >> 6);
1087 updateGlyphIfLCD(glyph);
1094 FT_GlyphSlot_Own_Bitmap(fFace->glyph);
1095 FT_Bitmap_Embolden(gFTLibrary, &fFace->glyph->bitmap, kBitmapEmboldenStrength, 0);
1100 vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.horiBearingX;
1101 vector.y = -fFace->glyph->metrics.vertBearingY - fFace->glyph->metrics.horiBearingY;
1103 fFace->glyph->bitmap_left += SkFDot6Floor(vector.x);
1104 fFace->glyph->bitmap_top += SkFDot6Floor(vector.y);
1107 glyph->fWidth = SkToU16(fFace->glyph->bitmap.width);
1108 glyph->fHeight = SkToU16(fFace->glyph->bitmap.rows);
1109 glyph->fTop = -SkToS16(fFace->glyph->bitmap_top);
1110 glyph->fLeft = SkToS16(fFace->glyph->bitmap_left);
1114 SkDEBUGFAIL("unknown glyph format");
1119 glyph->fAdvanceX = SkFDot6ToFixed(fFace->glyph->advance.x);
1120 glyph->fAdvanceY = -SkFDot6ToFixed(fFace->glyph->advance.y);
1122 glyph->fRsbDelta = SkToS8(fFace->glyph->rsb_delta);
1123 glyph->fLsbDelta = SkToS8(fFace->glyph->lsb_delta);
1126 glyph->fAdvanceX = SkFixedMul(fMatrix22.xx, fFace->glyph->linearHoriAdvance);
1127 glyph->fAdvanceY = -SkFixedMul(fMatrix22.yx, fFace->glyph->linearHoriAdvance);
1132 glyph->fAdvanceX = -SkFixedMul(fMatrix22.xy, fFace->glyph->linearVertAdvance);
1133 glyph->fAdvanceY = SkFixedMul(fMatrix22.yy, fFace->glyph->linearVertAdvance);
1135 glyph->fAdvanceX = -SkFDot6ToFixed(fFace->glyph->advance.x);
1136 glyph->fAdvanceY = SkFDot6ToFixed(fFace->glyph->advance.y);
1140 && fFace->glyph->format == FT_GLYPH_FORMAT_OUTLINE) {
1149 // glyph with the identity matrix to get the necessary bounding box
1154 err = FT_Load_Glyph( fFace, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags );
1156 SkDEBUGF(("SkScalerContext_FreeType::generateMetrics(%x): FT_Load_Glyph(glyph:%d flags:%d) returned 0x%x\n",
1157 fFaceRec->fFontID, glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags, err));
1162 emboldenOutline(&fFace->glyph->outline);
1166 // bounding box of the unskewed and unscaled glyph
1168 getBBoxForCurrentGlyph(glyph, &bbox);
1170 // compute the vertical gap above and below the glyph if the glyph were
1172 SkFixed vGap = (fFace->glyph->linearVertAdvance - Dot6ToFixed(bbox.yMax - bbox.yMin)) / 2;
1174 // the origin point of the glyph when rendered vertically
1176 vOrigin.x = fFace->glyph->linearHoriAdvance / 2;
1179 // transform the vertical origin based on the matrix of the actual glyph
1182 // compute a new offset vector for the glyph by subtracting the vertical
1184 glyph->fLeft = SkFixedRoundToInt(vLeft - vOrigin.x);
1185 glyph->fTop = -SkFixedRoundToInt(vTop - vOrigin.y);
1187 updateGlyphIfLCD(glyph);
1190 glyph->fAdvanceX = -SkFixedMul(fMatrix22.xy, fFace->glyph->linearVertAdvance);
1191 glyph->fAdvanceY = SkFixedMul(fMatrix22.yy, fFace->glyph->linearVertAdvance);
1197 SkDEBUGF(("Metrics(glyph:%d flags:0x%x) w:%d\n", glyph->getGlyphID(fBaseGlyphCount), fLoadGlyphFlags, glyph->fWidth));
1293 static void copyFT2LCD16(const SkGlyph& glyph, const FT_Bitmap& bitmap,
1296 SkASSERT(glyph.fHeight == bitmap.rows);
1297 uint16_t* dst = reinterpret_cast<uint16_t*>(glyph.fImage);
1298 const size_t dstRB = glyph.rowBytes();
1299 const int width = glyph.fWidth;
1304 for (int y = 0; y < glyph.fHeight; ++y) {
1313 for (int y = 0; y < glyph.fHeight; ++y) {
1322 SkASSERT(glyph.fWidth * 3 == bitmap.width);
1323 for (int y = 0; y < glyph.fHeight; y++) {
1347 void SkScalerContext_FreeType::generateImage(const SkGlyph& glyph) {
1356 err = FT_Load_Glyph( fFace, glyph.getGlyphID(fBaseGlyphCount), fLoadGlyphFlags);
1358 SkDEBUGF(("SkScalerContext_FreeType::generateImage: FT_Load_Glyph(glyph:%d width:%d height:%d rb:%d flags:%d) returned 0x%x\n",
1359 glyph.getGlyphID(fBaseGlyphCount), glyph.fWidth, glyph.fHeight, glyph.rowBytes(), fLoadGlyphFlags, err));
1361 memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
1385 switch ( fFace->glyph->format ) {
1387 FT_Outline* outline = &fFace->glyph->outline;
1397 dx = glyph.getSubXFixed() >> 10;
1398 dy = glyph.getSubYFixed() >> 10;
1414 if (SkMask::kLCD16_Format == glyph.fMaskFormat) {
1415 FT_Render_Glyph(fFace->glyph, FT_RENDER_MODE_LCD);
1416 copyFT2LCD16(glyph, fFace->glyph->bitmap,
1420 target.width = glyph.fWidth;
1421 target.rows = glyph.fHeight;
1422 target.pitch = glyph.rowBytes();
1423 target.buffer = reinterpret_cast<uint8_t*>(glyph.fImage);
1428 memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
1435 FT_GlyphSlot_Own_Bitmap(fFace->glyph);
1436 FT_Bitmap_Embolden(gFTLibrary, &fFace->glyph->bitmap, kBitmapEmboldenStrength, 0);
1438 SkASSERT_CONTINUE(glyph.fWidth == fFace->glyph->bitmap.width);
1439 SkASSERT_CONTINUE(glyph.fHeight == fFace->glyph->bitmap.rows);
1440 SkASSERT_CONTINUE(glyph.fTop == -fFace->glyph->bitmap_top);
1441 SkASSERT_CONTINUE(glyph.fLeft == fFace->glyph->bitmap_left);
1443 const uint8_t* src = (const uint8_t*)fFace->glyph->bitmap.buffer;
1444 uint8_t* dst = (uint8_t*)glyph.fImage;
1446 if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY ||
1447 (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO &&
1448 glyph.fMaskFormat == SkMask::kBW_Format)) {
1449 unsigned srcRowBytes = fFace->glyph->bitmap.pitch;
1450 unsigned dstRowBytes = glyph.rowBytes();
1454 for (int y = fFace->glyph->bitmap.rows - 1; y >= 0; --y) {
1460 } else if (fFace->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_MONO &&
1461 glyph.fMaskFormat == SkMask::kA8_Format) {
1462 for (int y = 0; y < fFace->glyph->bitmap.rows; ++y) {
1468 for (int x = 0; x < fFace->glyph->bitmap.width; ++x) {
1479 src += fFace->glyph->bitmap.pitch;
1480 dst += glyph.rowBytes();
1482 } else if (SkMask::kLCD16_Format == glyph.fMaskFormat) {
1483 copyFT2LCD16(glyph, fFace->glyph->bitmap,
1487 SkDEBUGFAIL("unknown glyph bitmap transform needed");
1492 SkDEBUGFAIL("unknown glyph format");
1499 if (SkMask::kA8_Format == glyph.fMaskFormat) {
1502 uint8_t* SK_RESTRICT dst = (uint8_t*)glyph.fImage;
1503 unsigned rowBytes = glyph.rowBytes();
1505 for (int y = glyph.fHeight - 1; y >= 0; --y) {
1506 for (int x = glyph.fWidth - 1; x >= 0; --x) {
1553 void SkScalerContext_FreeType::generatePath(const SkGlyph& glyph,
1557 SkASSERT(&glyph && path);
1568 FT_Error err = FT_Load_Glyph( fFace, glyph.getGlyphID(fBaseGlyphCount), flags);
1571 SkDEBUGF(("SkScalerContext_FreeType::generatePath: FT_Load_Glyph(glyph:%d flags:%d) returned 0x%x\n",
1572 glyph.getGlyphID(fBaseGlyphCount), flags, err));
1578 emboldenOutline(&fFace->glyph->outline);
1583 vector.x = fFace->glyph->metrics.vertBearingX - fFace->glyph->metrics.horiBearingX;
1584 vector.y = -fFace->glyph->metrics.vertBearingY - fFace->glyph->metrics.horiBearingY;
1586 FT_Outline_Translate(&fFace->glyph->outline, vector.x, vector.y);
1598 err = FT_Outline_Decompose(&fFace->glyph->outline, &funcs, path);
1601 SkDEBUGF(("SkScalerContext_FreeType::generatePath: FT_Load_Glyph(glyph:%d flags:%d) returned 0x%x\n",
1602 glyph.getGlyphID(fBaseGlyphCount), flags, err));
1668 emboldenOutline(&fFace->glyph->outline);
1670 FT_Outline_Get_CBox(&fFace->glyph->outline, &bbox);