Lines Matching refs:glyph
283 // horizontal glyphs and the subpixel flag should not affect glyph shapes.
426 bool SkScalerContext_DW::generateAdvance(SkGlyph* glyph) {
427 glyph->fAdvanceX = 0;
428 glyph->fAdvanceY = 0;
429 uint16_t glyphId = glyph->getGlyphID();
432 // DirectWrite treats all out of bounds glyph ids as having the same data as glyph 0.
433 // For consistency with all other backends, treat out of range glyph ids as an error.
453 "Could not get gdi compatible glyph metrics.");
477 glyph->fAdvanceX = SkScalarToFloat(advance.fX);
478 glyph->fAdvanceY = SkScalarToFloat(advance.fY);
482 HRESULT SkScalerContext_DW::getBoundingBox(SkGlyph* glyph,
490 fXform.dx = SkFixedToFloat(glyph->getSubXFixed());
491 fXform.dy = SkFixedToFloat(glyph->getSubYFixed());
495 UINT16 glyphId = glyph->getGlyphID();
529 "Could not create DW2 glyph run analysis.");
539 "Could not create glyph run analysis.");
550 bool SkScalerContext_DW::isColorGlyph(const SkGlyph& glyph) {
552 return getColorGlyphRun(glyph, &colorLayer);
555 bool SkScalerContext_DW::isPngGlyph(const SkGlyph& glyph) {
562 HRBM(fontFace4->GetGlyphImageFormats_(glyph.getGlyphID(), 0, UINT32_MAX, &f),
563 "Cannot get glyph image formats.");
567 bool SkScalerContext_DW::getColorGlyphRun(const SkGlyph& glyph,
571 UINT16 glyphId = glyph.getGlyphID();
592 HRBM(hr, "Failed to translate color glyph run");
596 void SkScalerContext_DW::generateColorMetrics(SkGlyph* glyph) {
598 if (!getColorGlyphRun(*glyph, &colorLayers)) {
607 HRVM(colorLayers->GetCurrentRun(&colorGlyph), "Could not get current color glyph run");
624 "Could not create glyph outline.");
630 matrix.postTranslate(SkFixedToScalar(glyph->getSubXFixed()),
631 SkFixedToScalar(glyph->getSubYFixed()));
637 glyph->fWidth = ibounds.fRight - ibounds.fLeft;
638 glyph->fHeight = ibounds.fBottom - ibounds.fTop;
639 glyph->fLeft = ibounds.fLeft;
640 glyph->fTop = ibounds.fTop;
660 void SkScalerContext_DW::generatePngMetrics(SkGlyph* glyph) {
661 SkASSERT(isPngGlyph(*glyph));
662 SkASSERT(glyph->fMaskFormat == SkMask::Format::kARGB32_Format);
668 HRVM(fontFace4->GetGlyphImageData(glyph->getGlyphID(),
697 matrix.postTranslate(SkFixedToScalar(glyph->getSubXFixed()),
698 SkFixedToScalar(glyph->getSubYFixed()));
703 glyph->fWidth = bounds.width();
704 glyph->fHeight = bounds.height();
705 glyph->fLeft = bounds.left();
706 glyph->fTop = bounds.top();
710 void SkScalerContext_DW::generateMetrics(SkGlyph* glyph) {
716 auto glyphCheckAndSetBounds = [](SkGlyph* glyph, const RECT& bbox) {
728 glyph->fWidth = SkToU16(bbox.right - bbox.left);
729 glyph->fHeight = SkToU16(bbox.bottom - bbox.top);
730 glyph->fLeft = SkToS16(bbox.left);
731 glyph->fTop = SkToS16(bbox.top);
735 glyph->fWidth = 0;
736 glyph->fHeight = 0;
737 glyph->fLeft = 0;
738 glyph->fTop = 0;
739 glyph->fMaskFormat = fRec.fMaskFormat;
741 if (!this->generateAdvance(glyph)) {
745 if (fIsColorFont && isColorGlyph(*glyph)) {
746 glyph->fMaskFormat = SkMask::kARGB32_Format;
747 generateColorMetrics(glyph);
751 if (fIsColorFont && isPngGlyph(*glyph)) {
752 glyph->fMaskFormat = SkMask::kARGB32_Format;
753 generatePngMetrics(glyph);
758 HRVM(this->getBoundingBox(glyph, fRenderingMode, fTextureType, &bbox),
761 if (glyphCheckAndSetBounds(glyph, bbox)) {
771 HRVM(this->getBoundingBox(glyph,
776 if (glyphCheckAndSetBounds(glyph, bbox)) {
777 glyph->fForceBW = 1;
778 glyph->fMaskFormat = SkMask::kBW_Format;
866 void SkScalerContext_DW::BilevelToBW(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph) {
867 const int width = glyph.width();
869 uint8_t* SK_RESTRICT dst = static_cast<uint8_t*>(glyph.fImage);
874 for (int y = 0; y < glyph.height(); ++y) {
906 const SkGlyph& glyph,
908 const size_t dstRB = glyph.rowBytes();
909 const int width = glyph.width();
910 uint8_t* SK_RESTRICT dst = static_cast<uint8_t*>(glyph.fImage);
912 for (int y = 0; y < glyph.height(); y++) {
923 const SkGlyph& glyph,
925 const size_t dstRB = glyph.rowBytes();
926 const int width = glyph.width();
927 uint8_t* SK_RESTRICT dst = static_cast<uint8_t*>(glyph.fImage);
929 for (int y = 0; y < glyph.height(); y++) {
941 void SkScalerContext_DW::RGBToLcd16(const uint8_t* SK_RESTRICT src, const SkGlyph& glyph,
944 const size_t dstRB = glyph.rowBytes();
945 const int width = glyph.width();
946 uint16_t* SK_RESTRICT dst = static_cast<uint16_t*>(glyph.fImage);
948 for (int y = 0; y < glyph.height(); y++) {
966 const void* SkScalerContext_DW::drawDWMask(const SkGlyph& glyph,
972 int sizeNeeded = glyph.width() * glyph.height();
983 fXform.dx = SkFixedToFloat(glyph.getSubXFixed());
984 fXform.dy = SkFixedToFloat(glyph.getSubYFixed());
988 UINT16 index = glyph.getGlyphID();
1021 "Could not create DW2 glyph run analysis.");
1031 "Could not create glyph run analysis.");
1034 //NOTE: this assumes that the glyph has already been measured
1035 //with an exact same glyph run analysis.
1037 bbox.left = glyph.left();
1038 bbox.top = glyph.top();
1039 bbox.right = glyph.left() + glyph.width();
1040 bbox.bottom = glyph.top() + glyph.height();
1053 void SkScalerContext_DW::generateColorGlyphImage(const SkGlyph& glyph) {
1054 SkASSERT(isColorGlyph(glyph));
1055 SkASSERT(glyph.fMaskFormat == SkMask::Format::kARGB32_Format);
1057 memset(glyph.fImage, 0, glyph.imageSize());
1060 getColorGlyphRun(glyph, &colorLayers);
1064 matrix.postTranslate(-SkIntToScalar(glyph.left()), -SkIntToScalar(glyph.top()));
1066 matrix.postTranslate(SkFixedToScalar(glyph.getSubXFixed()),
1067 SkFixedToScalar(glyph.getSubYFixed()));
1069 SkRasterClip rc(SkIRect::MakeWH(glyph.width(), glyph.height()));
1071 draw.fDst = SkPixmap(SkImageInfo::MakeN32(glyph.width(), glyph.height(), kPremul_SkAlphaType),
1072 glyph.fImage,
1073 glyph.rowBytesUsingFormat(SkMask::Format::kARGB32_Format));
1084 HRVM(colorLayers->GetCurrentRun(&colorGlyph), "Could not get current color glyph run");
1117 "Could not create glyph outline.");
1123 void SkScalerContext_DW::generatePngGlyphImage(const SkGlyph& glyph) {
1124 SkASSERT(isPngGlyph(glyph));
1125 SkASSERT(glyph.fMaskFormat == SkMask::Format::kARGB32_Format);
1131 HRVM(fontFace4->GetGlyphImageData(glyph.getGlyphID(),
1145 dstBitmap.setInfo(SkImageInfo::Make(glyph.width(), glyph.height(),
1148 glyph.rowBytes());
1149 dstBitmap.setPixels(glyph.fImage);
1153 canvas.translate(-glyph.left(), -glyph.top());
1155 canvas.translate(SkFixedToScalar(glyph.getSubXFixed()),
1156 SkFixedToScalar(glyph.getSubYFixed()));
1165 void SkScalerContext_DW::generateImage(const SkGlyph& glyph) {
1169 if (glyph.fForceBW) {
1174 if (SkMask::kARGB32_Format == glyph.fMaskFormat) {
1176 if (isColorGlyph(glyph)) {
1177 generateColorGlyphImage(glyph);
1179 } else if (isPngGlyph(glyph)) {
1180 generatePngGlyphImage(glyph);
1188 const void* bits = this->drawDWMask(glyph, renderingMode, textureType);
1190 sk_bzero(glyph.fImage, glyph.imageSize());
1194 //Copy the mask into the glyph.
1197 SkASSERT(SkMask::kBW_Format == glyph.fMaskFormat);
1199 BilevelToBW(src, glyph);
1203 GrayscaleToA8<true>(src, glyph, fPreBlend.fG);
1205 GrayscaleToA8<false>(src, glyph, fPreBlend.fG);
1209 RGBToA8<true>(src, glyph, fPreBlend.fG);
1211 RGBToA8<false>(src, glyph, fPreBlend.fG);
1215 SkASSERT(SkMask::kLCD16_Format == glyph.fMaskFormat);
1218 RGBToLcd16<true, false>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1220 RGBToLcd16<true, true>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1224 RGBToLcd16<false, false>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1226 RGBToLcd16<false, true>(src, glyph, fPreBlend.fR, fPreBlend.fG, fPreBlend.fB);
1232 bool SkScalerContext_DW::generatePath(SkGlyphID glyph, SkPath* path) {
1236 // DirectWrite treats all out of bounds glyph ids as having the same data as glyph 0.
1237 // For consistency with all other backends, treat out of range glyph ids as an error.
1238 if (fGlyphCount <= glyph) {
1245 UINT16 glyphId = SkTo<UINT16>(glyph);
1259 "Could not create glyph outline.");