24 CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little;
25 switch (pBitmap->GetFormat()) {
26 case FXDIB_Format::kRgb32:
27 bmpInfo |= kCGImageAlphaNoneSkipFirst;
29 case FXDIB_Format::kArgb:
33 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
34 CGContextRef context = CGBitmapContextCreate(
35 pBitmap->GetWritableBuffer().data(), pBitmap->GetWidth(),
36 pBitmap->GetHeight(), 8, pBitmap->GetPitch(), colorSpace, bmpInfo);
37 CGColorSpaceRelease(colorSpace);
47 CGDataProviderRef pDataProvider = CGDataProviderCreateWithData(
48 nullptr, pFontData.data(), pFontData.size(),
nullptr);
52 CGFontRef pCGFont = CGFontCreateWithDataProvider(pDataProvider);
53 CGDataProviderRelease(pDataProvider);
75 pdfium::span<uint16_t> glyphIndices,
76 pdfium::span<CGPoint> glyphPositions,
81 CGContextRef context = (CGContextRef)graphics;
82 CGContextSetFont(context, (CGFontRef)font);
83 CGContextSetFontSize(context, fontSize);
89 std::tie(a, r, g, b) = ArgbDecode(argb);
90 CGContextSetRGBFillColor(context, r / 255.f, g / 255.f, b / 255.f, a / 255.f);
91 CGContextSaveGState(context);
93 CGPoint* glyphPositionsCG =
new CGPoint[glyphPositions.size()];
94 for (size_t index = 0; index < glyphPositions.size(); ++index) {
95 glyphPositionsCG[index].x = glyphPositions[index].x;
96 glyphPositionsCG[index].y = glyphPositions[index].y;
99 CGPoint* glyphPositionsCG = glyphPositions.data();
101 CGContextShowGlyphsAtPositions(
102 context,
reinterpret_cast<CGGlyph*>(glyphIndices.data()),
103 glyphPositionsCG, glyphPositions.size());
105 delete[] glyphPositionsCG;
107 CGContextRestoreGState(context);
bool DrawGraphicsString(void *graphics, void *font, float fontSize, pdfium::span< uint16_t > glyphIndices, pdfium::span< CGPoint > glyphPositions, FX_ARGB argb)