mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1053652 - Cannot open include file: 'dwrite_1.h'. r=gw280
Imports/Transplants upstream https://codereview.chromium.org/552383002/
This commit is contained in:
parent
2fe70240b6
commit
3c332288c4
@ -26,7 +26,9 @@
|
||||
#include "SkTypeface_win_dw.h"
|
||||
|
||||
#include <dwrite.h>
|
||||
#include <dwrite_1.h>
|
||||
#if SK_HAS_DWRITE_1_H
|
||||
# include <dwrite_1.h>
|
||||
#endif
|
||||
|
||||
static bool isLCD(const SkScalerContext::Rec& rec) {
|
||||
return SkMask::kLCD16_Format == rec.fMaskFormat ||
|
||||
@ -479,6 +481,7 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlineThinknessIsValid_Flag;
|
||||
metrics->fFlags |= SkPaint::FontMetrics::kUnderlinePositionIsValid_Flag;
|
||||
|
||||
#if SK_HAS_DWRITE_1_H
|
||||
if (NULL != fTypeface->fDWriteFontFace1.get()) {
|
||||
DWRITE_FONT_METRICS1 dwfm1;
|
||||
fTypeface->fDWriteFontFace1->GetMetrics(&dwfm1);
|
||||
@ -488,23 +491,28 @@ void SkScalerContext_DW::generateFontMetrics(SkPaint::FontMetrics* metrics) {
|
||||
metrics->fXMax = fTextSizeRender * SkIntToScalar(dwfm1.glyphBoxRight) / upem;
|
||||
|
||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||
} else {
|
||||
AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get());
|
||||
if (head.fExists &&
|
||||
head.fSize >= sizeof(SkOTTableHead) &&
|
||||
head->version == SkOTTableHead::version1)
|
||||
{
|
||||
metrics->fTop = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->yMax) / upem;
|
||||
metrics->fBottom = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->yMin) / upem;
|
||||
metrics->fXMin = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMin) / upem;
|
||||
metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMax) / upem;
|
||||
|
||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||
} else {
|
||||
metrics->fTop = metrics->fAscent;
|
||||
metrics->fBottom = metrics->fDescent;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#else
|
||||
# pragma message("No dwrite_1.h is available, font metrics may be affected.")
|
||||
#endif
|
||||
|
||||
AutoTDWriteTable<SkOTTableHead> head(fTypeface->fDWriteFontFace.get());
|
||||
if (head.fExists &&
|
||||
head.fSize >= sizeof(SkOTTableHead) &&
|
||||
head->version == SkOTTableHead::version1)
|
||||
{
|
||||
metrics->fTop = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->yMax) / upem;
|
||||
metrics->fBottom = -fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->yMin) / upem;
|
||||
metrics->fXMin = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMin) / upem;
|
||||
metrics->fXMax = fTextSizeRender * (int16_t)SkEndian_SwapBE16(head->xMax) / upem;
|
||||
|
||||
metrics->fMaxCharWidth = metrics->fXMax - metrics->fXMin;
|
||||
return;
|
||||
}
|
||||
|
||||
metrics->fTop = metrics->fAscent;
|
||||
metrics->fBottom = metrics->fDescent;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,7 +17,9 @@
|
||||
#include "SkTypes.h"
|
||||
|
||||
#include <dwrite.h>
|
||||
#include <dwrite_1.h>
|
||||
#if SK_HAS_DWRITE_1_H
|
||||
# include <dwrite_1.h>
|
||||
#endif
|
||||
|
||||
class SkFontDescriptor;
|
||||
struct SkScalerContextRec;
|
||||
@ -52,11 +54,13 @@ private:
|
||||
, fDWriteFont(SkRefComPtr(font))
|
||||
, fDWriteFontFace(SkRefComPtr(fontFace))
|
||||
{
|
||||
#if SK_HAS_DWRITE_1_H
|
||||
if (!SUCCEEDED(fDWriteFontFace->QueryInterface(&fDWriteFontFace1))) {
|
||||
// IUnknown::QueryInterface states that if it fails, punk will be set to NULL.
|
||||
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/26/96777.aspx
|
||||
SK_ALWAYSBREAK(NULL == fDWriteFontFace1.get());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
@ -66,7 +70,9 @@ public:
|
||||
SkTScopedComPtr<IDWriteFontFamily> fDWriteFontFamily;
|
||||
SkTScopedComPtr<IDWriteFont> fDWriteFont;
|
||||
SkTScopedComPtr<IDWriteFontFace> fDWriteFontFace;
|
||||
#if SK_HAS_DWRITE_1_H
|
||||
SkTScopedComPtr<IDWriteFontFace1> fDWriteFontFace1;
|
||||
#endif
|
||||
|
||||
static DWriteFontTypeface* Create(IDWriteFactory* factory,
|
||||
IDWriteFontFace* fontFace,
|
||||
|
@ -11,12 +11,17 @@
|
||||
#include "SkTemplates.h"
|
||||
|
||||
#include <dwrite.h>
|
||||
#include <winsdkver.h>
|
||||
|
||||
class SkString;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Factory
|
||||
|
||||
#ifndef SK_HAS_DWRITE_1_H
|
||||
#define SK_HAS_DWRITE_1_H (WINVER_MAXVER >= 0x0602)
|
||||
#endif
|
||||
|
||||
IDWriteFactory* sk_get_dwrite_factory();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user