OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef UNICODE | 8 #ifndef UNICODE |
9 #define UNICODE | 9 #define UNICODE |
10 #endif | 10 #endif |
11 #ifndef _UNICODE | 11 #ifndef _UNICODE |
12 #define _UNICODE | 12 #define _UNICODE |
13 #endif | 13 #endif |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 #include <ObjBase.h> | 15 #include <ObjBase.h> |
16 #include <XpsObjectModel.h> | 16 #include <XpsObjectModel.h> |
17 #include <T2EmbApi.h> | 17 #include <T2EmbApi.h> |
18 #include <FontSub.h> | 18 #include <FontSub.h> |
19 | 19 |
20 #include "SkColor.h" | 20 #include "SkColor.h" |
21 #include "SkConstexprMath.h" | 21 #include "SkConstexprMath.h" |
22 #include "SkData.h" | 22 #include "SkData.h" |
23 #include "SkDraw.h" | 23 #include "SkDraw.h" |
24 #include "SkDrawProcs.h" | 24 #include "SkDrawProcs.h" |
| 25 #include "SkEndian.h" |
25 #include "SkFontHost.h" | 26 #include "SkFontHost.h" |
26 #include "SkGlyphCache.h" | 27 #include "SkGlyphCache.h" |
27 #include "SkHRESULT.h" | 28 #include "SkHRESULT.h" |
28 #include "SkImageEncoder.h" | 29 #include "SkImageEncoder.h" |
29 #include "SkIStream.h" | 30 #include "SkIStream.h" |
30 #include "SkMaskFilter.h" | 31 #include "SkMaskFilter.h" |
31 #include "SkPaint.h" | 32 #include "SkPaint.h" |
32 #include "SkPoint.h" | 33 #include "SkPoint.h" |
33 #include "SkRasterizer.h" | 34 #include "SkRasterizer.h" |
| 35 #include "SkSFNTHeader.h" |
34 #include "SkShader.h" | 36 #include "SkShader.h" |
35 #include "SkSize.h" | 37 #include "SkSize.h" |
36 #include "SkStream.h" | 38 #include "SkStream.h" |
37 #include "SkTDArray.h" | 39 #include "SkTDArray.h" |
38 #include "SkTLazy.h" | 40 #include "SkTLazy.h" |
39 #include "SkTScopedComPtr.h" | 41 #include "SkTScopedComPtr.h" |
| 42 #include "SkTTCFHeader.h" |
40 #include "SkTypefacePriv.h" | 43 #include "SkTypefacePriv.h" |
41 #include "SkUtils.h" | 44 #include "SkUtils.h" |
42 #include "SkXPSDevice.h" | 45 #include "SkXPSDevice.h" |
43 | 46 |
44 //Windows defines a FLOAT type, | 47 //Windows defines a FLOAT type, |
45 //make it clear when converting a scalar that this is what is wanted. | 48 //make it clear when converting a scalar that this is what is wanted. |
46 #define SkScalarToFLOAT(n) SkScalarToFloat(n) | 49 #define SkScalarToFLOAT(n) SkScalarToFloat(n) |
47 | 50 |
48 //Dummy representation of a GUID from create_id. | 51 //Dummy representation of a GUID from create_id. |
49 #define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX" | 52 #define L_GUID_ID L"XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX" |
(...skipping 23 matching lines...) Expand all Loading... |
73 guid.Data4[0], | 76 guid.Data4[0], |
74 guid.Data4[1], | 77 guid.Data4[1], |
75 sep, | 78 sep, |
76 guid.Data4[2], | 79 guid.Data4[2], |
77 guid.Data4[3], | 80 guid.Data4[3], |
78 guid.Data4[4], | 81 guid.Data4[4], |
79 guid.Data4[5], | 82 guid.Data4[5], |
80 guid.Data4[6], | 83 guid.Data4[6], |
81 guid.Data4[7]); | 84 guid.Data4[7]); |
82 } | 85 } |
| 86 |
83 /** | 87 /** |
84 Creates a GUID based id and places it into buffer. | 88 Creates a GUID based id and places it into buffer. |
85 buffer should have space for at least GUID_ID_LEN wide characters. | 89 buffer should have space for at least GUID_ID_LEN wide characters. |
86 The string will always be wchar null terminated. | 90 The string will always be wchar null terminated. |
87 XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX0 | 91 XXXXXXXXsXXXXsXXXXsXXXXsXXXXXXXXXXXX0 |
88 The string may begin with a digit, | 92 The string may begin with a digit, |
89 and so may not be suitable as a bare resource key. | 93 and so may not be suitable as a bare resource key. |
90 */ | 94 */ |
91 static HRESULT create_id(wchar_t* buffer, size_t bufferSize, | 95 static HRESULT create_id(wchar_t* buffer, size_t bufferSize, |
92 wchar_t sep = '-') { | 96 wchar_t sep = '-') { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 IXpsOMImageResource** image) { | 176 IXpsOMImageResource** image) { |
173 SkTScopedComPtr<IXpsOMThumbnailGenerator> thumbnailGenerator; | 177 SkTScopedComPtr<IXpsOMThumbnailGenerator> thumbnailGenerator; |
174 HRM(CoCreateInstance( | 178 HRM(CoCreateInstance( |
175 CLSID_XpsOMThumbnailGenerator, | 179 CLSID_XpsOMThumbnailGenerator, |
176 NULL, | 180 NULL, |
177 CLSCTX_INPROC_SERVER, | 181 CLSCTX_INPROC_SERVER, |
178 IID_PPV_ARGS(&thumbnailGenerator)), | 182 IID_PPV_ARGS(&thumbnailGenerator)), |
179 "Could not create thumbnail generator."); | 183 "Could not create thumbnail generator."); |
180 | 184 |
181 SkTScopedComPtr<IOpcPartUri> partUri; | 185 SkTScopedComPtr<IOpcPartUri> partUri; |
182 static const size_t size = SK_MAX( | 186 static const size_t size = SkTUMax< |
183 SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + SK_DIGITS_IN(pageNum), | 187 SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + SK_DIGITS_IN(pageNum), |
184 SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png") | 188 SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png") |
185 ); | 189 >::value; |
186 wchar_t buffer[size]; | 190 wchar_t buffer[size]; |
187 if (pageNum > 0) { | 191 if (pageNum > 0) { |
188 swprintf_s(buffer, size, L"/Documents/1/Metadata/%u.png", pageNum); | 192 swprintf_s(buffer, size, L"/Documents/1/Metadata/%u.png", pageNum); |
189 } else { | 193 } else { |
190 wchar_t id[GUID_ID_LEN]; | 194 wchar_t id[GUID_ID_LEN]; |
191 HR(create_id(id, GUID_ID_LEN)); | 195 HR(create_id(id, GUID_ID_LEN)); |
192 swprintf_s(buffer, size, L"/Metadata/%s.png", id); | 196 swprintf_s(buffer, size, L"/Metadata/%s.png", id); |
193 } | 197 } |
194 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), | 198 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), |
195 "Could not create thumbnail part uri."); | 199 "Could not create thumbnail part uri."); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 331 |
328 return true; | 332 return true; |
329 } | 333 } |
330 | 334 |
331 static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { | 335 static HRESULT subset_typeface(SkXPSDevice::TypefaceUse* current) { |
332 //CreateFontPackage wants unsigned short. | 336 //CreateFontPackage wants unsigned short. |
333 //Microsoft, Y U NO stdint.h? | 337 //Microsoft, Y U NO stdint.h? |
334 SkTDArray<unsigned short> keepList; | 338 SkTDArray<unsigned short> keepList; |
335 current->glyphsUsed->exportTo(&keepList); | 339 current->glyphsUsed->exportTo(&keepList); |
336 | 340 |
| 341 int ttcCount = (current->ttcIndex + 1); |
| 342 |
337 //The following are declared with the types required by CreateFontPackage. | 343 //The following are declared with the types required by CreateFontPackage. |
338 unsigned char *puchFontPackageBuffer; | 344 unsigned char *fontPackageBufferRaw = NULL; |
339 unsigned long pulFontPackageBufferSize; | 345 unsigned long fontPackageBufferSize; |
340 unsigned long pulBytesWritten; | 346 unsigned long bytesWritten; |
341 unsigned long result = CreateFontPackage( | 347 unsigned long result = CreateFontPackage( |
342 (unsigned char *) current->fontData->getMemoryBase(), | 348 (unsigned char *) current->fontData->getMemoryBase(), |
343 (unsigned long) current->fontData->getLength(), | 349 (unsigned long) current->fontData->getLength(), |
344 &puchFontPackageBuffer, | 350 &fontPackageBufferRaw, |
345 &pulFontPackageBufferSize, | 351 &fontPackageBufferSize, |
346 &pulBytesWritten, | 352 &bytesWritten, |
347 TTFCFP_FLAGS_SUBSET | TTFCFP_FLAGS_GLYPHLIST,// | TTFCFP_FLAGS_TTC, | 353 TTFCFP_FLAGS_SUBSET | TTFCFP_FLAGS_GLYPHLIST | (ttcCount > 0 ? TTFCFP_FL
AGS_TTC : 0), |
348 0,//TTC index | 354 current->ttcIndex, |
349 TTFCFP_SUBSET, | 355 TTFCFP_SUBSET, |
350 0, | 356 0, |
351 0, | 357 0, |
352 0, | 358 0, |
353 keepList.begin(), | 359 keepList.begin(), |
354 keepList.count(), | 360 keepList.count(), |
355 sk_malloc_throw, | 361 sk_malloc_throw, |
356 sk_realloc_throw, | 362 sk_realloc_throw, |
357 sk_free, | 363 sk_free, |
358 NULL); | 364 NULL); |
| 365 SkAutoTMalloc<unsigned char> fontPackageBuffer(fontPackageBufferRaw); |
359 if (result != NO_ERROR) { | 366 if (result != NO_ERROR) { |
360 SkDEBUGF(("CreateFontPackage Error %lu", result)); | 367 SkDEBUGF(("CreateFontPackage Error %lu", result)); |
361 return E_UNEXPECTED; | 368 return E_UNEXPECTED; |
362 } | 369 } |
363 | 370 |
364 SkMemoryStream* newStream = new SkMemoryStream; | 371 // If it was originally a ttc, keep it a ttc. |
365 newStream->setMemoryOwned(puchFontPackageBuffer, pulBytesWritten); | 372 // CreateFontPackage over-allocates, realloc usually decreases the size subs
tantially. |
| 373 size_t extra; |
| 374 if (ttcCount > 0) { |
| 375 // Create space for a ttc header. |
| 376 extra = sizeof(SkTTCFHeader) + (ttcCount * sizeof(SK_OT_ULONG)); |
| 377 fontPackageBuffer.realloc(bytesWritten + extra); |
| 378 //overlap is certain, use memmove |
| 379 memmove(fontPackageBuffer.get() + extra, fontPackageBuffer.get(), bytesW
ritten); |
| 380 |
| 381 // Write the ttc header. |
| 382 SkTTCFHeader* ttcfHeader = reinterpret_cast<SkTTCFHeader*>(fontPackageBu
ffer.get()); |
| 383 ttcfHeader->ttcTag = SkTTCFHeader::TAG; |
| 384 ttcfHeader->version = SkTTCFHeader::version_1; |
| 385 ttcfHeader->numOffsets = SkEndian_SwapBE32(ttcCount); |
| 386 SK_OT_ULONG* offsetPtr = SkTAfter<SK_OT_ULONG>(ttcfHeader); |
| 387 for (int i = 0; i < ttcCount; ++i, ++offsetPtr) { |
| 388 *offsetPtr = SkEndian_SwapBE32(extra); |
| 389 } |
| 390 |
| 391 // Fix up offsets in sfnt table entries. |
| 392 SkSFNTHeader* sfntHeader = SkTAddOffset<SkSFNTHeader>(fontPackageBuffer.
get(), extra); |
| 393 int numTables = SkEndian_SwapBE16(sfntHeader->numTables); |
| 394 SkSFNTHeader::TableDirectoryEntry* tableDirectory = |
| 395 SkTAfter<SkSFNTHeader::TableDirectoryEntry>(sfntHeader); |
| 396 for (int i = 0; i < numTables; ++i, ++tableDirectory) { |
| 397 tableDirectory->offset = SkEndian_SwapBE32( |
| 398 SkEndian_SwapBE32(tableDirectory->offset) + extra); |
| 399 } |
| 400 } else { |
| 401 extra = 0; |
| 402 fontPackageBuffer.realloc(bytesWritten); |
| 403 } |
| 404 |
| 405 SkAutoTUnref<SkMemoryStream> newStream(new SkMemoryStream()); |
| 406 newStream->setMemoryOwned(fontPackageBuffer.detach(), bytesWritten + extra); |
| 407 |
366 SkTScopedComPtr<IStream> newIStream; | 408 SkTScopedComPtr<IStream> newIStream; |
367 SkIStream::CreateFromSkStream(newStream, true, &newIStream); | 409 SkIStream::CreateFromSkStream(newStream.detach(), true, &newIStream); |
368 | 410 |
369 XPS_FONT_EMBEDDING embedding; | 411 XPS_FONT_EMBEDDING embedding; |
370 HRM(current->xpsFont->GetEmbeddingOption(&embedding), | 412 HRM(current->xpsFont->GetEmbeddingOption(&embedding), |
371 "Could not get embedding option from font."); | 413 "Could not get embedding option from font."); |
372 | 414 |
373 SkTScopedComPtr<IOpcPartUri> partUri; | 415 SkTScopedComPtr<IOpcPartUri> partUri; |
374 HRM(current->xpsFont->GetPartName(&partUri), | 416 HRM(current->xpsFont->GetPartName(&partUri), |
375 "Could not get part uri from font."); | 417 "Could not get part uri from font."); |
376 | 418 |
377 HRM(current->xpsFont->SetContent( | 419 HRM(current->xpsFont->SetContent( |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 return S_OK; | 2069 return S_OK; |
2028 } | 2070 } |
2029 } | 2071 } |
2030 } | 2072 } |
2031 | 2073 |
2032 //TODO: create glyph only fonts | 2074 //TODO: create glyph only fonts |
2033 //and let the host deal with what kind of font we're looking at. | 2075 //and let the host deal with what kind of font we're looking at. |
2034 XPS_FONT_EMBEDDING embedding = XPS_FONT_EMBEDDING_RESTRICTED; | 2076 XPS_FONT_EMBEDDING embedding = XPS_FONT_EMBEDDING_RESTRICTED; |
2035 | 2077 |
2036 SkTScopedComPtr<IStream> fontStream; | 2078 SkTScopedComPtr<IStream> fontStream; |
2037 SkStream* fontData = typeface->openStream(NULL); | 2079 int ttcIndex; |
| 2080 SkStream* fontData = typeface->openStream(&ttcIndex); |
2038 HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream), | 2081 HRM(SkIStream::CreateFromSkStream(fontData, true, &fontStream), |
2039 "Could not create font stream."); | 2082 "Could not create font stream."); |
2040 | 2083 |
2041 const size_t size = | 2084 const size_t size = |
2042 SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf"); | 2085 SK_ARRAY_COUNT(L"/Resources/Fonts/" L_GUID_ID L".odttf"); |
2043 wchar_t buffer[size]; | 2086 wchar_t buffer[size]; |
2044 wchar_t id[GUID_ID_LEN]; | 2087 wchar_t id[GUID_ID_LEN]; |
2045 HR(create_id(id, GUID_ID_LEN)); | 2088 HR(create_id(id, GUID_ID_LEN)); |
2046 swprintf_s(buffer, size, L"/Resources/Fonts/%s.odttf", id); | 2089 swprintf_s(buffer, size, L"/Resources/Fonts/%s.odttf", id); |
2047 | 2090 |
2048 SkTScopedComPtr<IOpcPartUri> partUri; | 2091 SkTScopedComPtr<IOpcPartUri> partUri; |
2049 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), | 2092 HRM(this->fXpsFactory->CreatePartUri(buffer, &partUri), |
2050 "Could not create font resource part uri."); | 2093 "Could not create font resource part uri."); |
2051 | 2094 |
2052 SkTScopedComPtr<IXpsOMFontResource> xpsFontResource; | 2095 SkTScopedComPtr<IXpsOMFontResource> xpsFontResource; |
2053 HRM(this->fXpsFactory->CreateFontResource(fontStream.get(), | 2096 HRM(this->fXpsFactory->CreateFontResource(fontStream.get(), |
2054 embedding, | 2097 embedding, |
2055 partUri.get(), | 2098 partUri.get(), |
2056 FALSE, | 2099 FALSE, |
2057 &xpsFontResource), | 2100 &xpsFontResource), |
2058 "Could not create font resource."); | 2101 "Could not create font resource."); |
2059 | 2102 |
| 2103 //TODO: change openStream to return -1 for non-ttc, get rid of this. |
| 2104 uint8_t* data = (uint8_t*)fontData->getMemoryBase(); |
| 2105 bool isTTC = (data && |
| 2106 fontData->getLength() >= sizeof(SkTTCFHeader) && |
| 2107 ((SkTTCFHeader*)data)->ttcTag == SkTTCFHeader::TAG); |
| 2108 |
2060 TypefaceUse& newTypefaceUse = this->fTypefaces.push_back(); | 2109 TypefaceUse& newTypefaceUse = this->fTypefaces.push_back(); |
2061 newTypefaceUse.typefaceId = typefaceID; | 2110 newTypefaceUse.typefaceId = typefaceID; |
| 2111 newTypefaceUse.ttcIndex = isTTC ? ttcIndex : -1; |
2062 newTypefaceUse.fontData = fontData; | 2112 newTypefaceUse.fontData = fontData; |
2063 newTypefaceUse.xpsFont = xpsFontResource.release(); | 2113 newTypefaceUse.xpsFont = xpsFontResource.release(); |
2064 | 2114 |
2065 SkAutoGlyphCache agc = SkAutoGlyphCache(paint, NULL, &SkMatrix::I()); | 2115 SkAutoGlyphCache agc = SkAutoGlyphCache(paint, NULL, &SkMatrix::I()); |
2066 SkGlyphCache* glyphCache = agc.getCache(); | 2116 SkGlyphCache* glyphCache = agc.getCache(); |
2067 unsigned int glyphCount = glyphCache->getGlyphCount(); | 2117 unsigned int glyphCount = glyphCache->getGlyphCount(); |
2068 newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount); | 2118 newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount); |
2069 | 2119 |
2070 *typefaceUse = &newTypefaceUse; | 2120 *typefaceUse = &newTypefaceUse; |
2071 return S_OK; | 2121 return S_OK; |
2072 } | 2122 } |
2073 | 2123 |
2074 HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, | 2124 HRESULT SkXPSDevice::AddGlyphs(const SkDraw& d, |
2075 IXpsOMObjectFactory* xpsFactory, | 2125 IXpsOMObjectFactory* xpsFactory, |
2076 IXpsOMCanvas* canvas, | 2126 IXpsOMCanvas* canvas, |
2077 IXpsOMFontResource* font, | 2127 TypefaceUse* font, |
2078 LPCWSTR text, | 2128 LPCWSTR text, |
2079 XPS_GLYPH_INDEX* xpsGlyphs, | 2129 XPS_GLYPH_INDEX* xpsGlyphs, |
2080 UINT32 xpsGlyphsLen, | 2130 UINT32 xpsGlyphsLen, |
2081 XPS_POINT *origin, | 2131 XPS_POINT *origin, |
2082 FLOAT fontSize, | 2132 FLOAT fontSize, |
2083 XPS_STYLE_SIMULATION sims, | 2133 XPS_STYLE_SIMULATION sims, |
2084 const SkMatrix& transform, | 2134 const SkMatrix& transform, |
2085 const SkPaint& paint) { | 2135 const SkPaint& paint) { |
2086 SkTScopedComPtr<IXpsOMGlyphs> glyphs; | 2136 SkTScopedComPtr<IXpsOMGlyphs> glyphs; |
2087 HRM(xpsFactory->CreateGlyphs(font, &glyphs), "Could not create glyphs."); | 2137 HRM(xpsFactory->CreateGlyphs(font->xpsFont, &glyphs), "Could not create glyp
hs."); |
| 2138 HRM(glyphs->SetFontFaceIndex(font->ttcIndex), "Could not set glyph font face
index."); |
2088 | 2139 |
2089 //XPS uses affine transformations for everything... | 2140 //XPS uses affine transformations for everything... |
2090 //...except positioning text. | 2141 //...except positioning text. |
2091 bool useCanvasForClip; | 2142 bool useCanvasForClip; |
2092 if ((transform.getType() & ~SkMatrix::kTranslate_Mask) == 0) { | 2143 if ((transform.getType() & ~SkMatrix::kTranslate_Mask) == 0) { |
2093 origin->x += SkScalarToFLOAT(transform.getTranslateX()); | 2144 origin->x += SkScalarToFLOAT(transform.getTranslateX()); |
2094 origin->y += SkScalarToFLOAT(transform.getTranslateY()); | 2145 origin->y += SkScalarToFLOAT(transform.getTranslateY()); |
2095 useCanvasForClip = false; | 2146 useCanvasForClip = false; |
2096 } else { | 2147 } else { |
2097 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse; | 2148 SkTScopedComPtr<IXpsOMMatrixTransform> xpsMatrixToUse; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 XPS_POINT origin = { | 2326 XPS_POINT origin = { |
2276 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, | 2327 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, |
2277 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, | 2328 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, |
2278 }; | 2329 }; |
2279 procs.xpsGlyphs[0].horizontalOffset = 0.0f; | 2330 procs.xpsGlyphs[0].horizontalOffset = 0.0f; |
2280 procs.xpsGlyphs[0].verticalOffset = 0.0f; | 2331 procs.xpsGlyphs[0].verticalOffset = 0.0f; |
2281 | 2332 |
2282 HRV(AddGlyphs(d, | 2333 HRV(AddGlyphs(d, |
2283 this->fXpsFactory.get(), | 2334 this->fXpsFactory.get(), |
2284 this->fCurrentXpsCanvas.get(), | 2335 this->fCurrentXpsCanvas.get(), |
2285 typeface->xpsFont, | 2336 typeface, |
2286 NULL, | 2337 NULL, |
2287 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), | 2338 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), |
2288 &origin, | 2339 &origin, |
2289 SkScalarToFLOAT(paint.getTextSize()), | 2340 SkScalarToFLOAT(paint.getTextSize()), |
2290 XPS_STYLE_SIMULATION_NONE, | 2341 XPS_STYLE_SIMULATION_NONE, |
2291 *d.fMatrix, | 2342 *d.fMatrix, |
2292 paint)); | 2343 paint)); |
2293 } | 2344 } |
2294 | 2345 |
2295 void SkXPSDevice::drawPosText(const SkDraw& d, | 2346 void SkXPSDevice::drawPosText(const SkDraw& d, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 XPS_POINT origin = { | 2378 XPS_POINT origin = { |
2328 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, | 2379 procs.xpsGlyphs[0].horizontalOffset / procs.centemPerUnit, |
2329 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, | 2380 procs.xpsGlyphs[0].verticalOffset / -procs.centemPerUnit, |
2330 }; | 2381 }; |
2331 procs.xpsGlyphs[0].horizontalOffset = 0.0f; | 2382 procs.xpsGlyphs[0].horizontalOffset = 0.0f; |
2332 procs.xpsGlyphs[0].verticalOffset = 0.0f; | 2383 procs.xpsGlyphs[0].verticalOffset = 0.0f; |
2333 | 2384 |
2334 HRV(AddGlyphs(d, | 2385 HRV(AddGlyphs(d, |
2335 this->fXpsFactory.get(), | 2386 this->fXpsFactory.get(), |
2336 this->fCurrentXpsCanvas.get(), | 2387 this->fCurrentXpsCanvas.get(), |
2337 typeface->xpsFont, | 2388 typeface, |
2338 NULL, | 2389 NULL, |
2339 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), | 2390 procs.xpsGlyphs.begin(), procs.xpsGlyphs.count(), |
2340 &origin, | 2391 &origin, |
2341 SkScalarToFLOAT(paint.getTextSize()), | 2392 SkScalarToFLOAT(paint.getTextSize()), |
2342 XPS_STYLE_SIMULATION_NONE, | 2393 XPS_STYLE_SIMULATION_NONE, |
2343 *d.fMatrix, | 2394 *d.fMatrix, |
2344 paint)); | 2395 paint)); |
2345 } | 2396 } |
2346 | 2397 |
2347 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len, | 2398 void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2411 IID_PPV_ARGS(&this->fXpsFactory)), | 2462 IID_PPV_ARGS(&this->fXpsFactory)), |
2412 "Could not create factory for layer."); | 2463 "Could not create factory for layer."); |
2413 | 2464 |
2414 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), | 2465 HRVM(this->fXpsFactory->CreateCanvas(&this->fCurrentXpsCanvas), |
2415 "Could not create canvas for layer."); | 2466 "Could not create canvas for layer."); |
2416 } | 2467 } |
2417 | 2468 |
2418 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { | 2469 bool SkXPSDevice::allowImageFilter(SkImageFilter*) { |
2419 return false; | 2470 return false; |
2420 } | 2471 } |
OLD | NEW |