mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed Windows bug causing wrong text positions for DirectDraw text layout.
This commit is contained in:
parent
abf5cb18d5
commit
cddf0cfc8a
1 changed files with 31 additions and 19 deletions
|
|
@ -52,11 +52,37 @@ namespace DirectWriteTypeLayout
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT GetCurrentTransform (void*, DWRITE_MATRIX*) { return S_OK; }
|
||||
JUCE_COMRESULT GetPixelsPerDip (void*, FLOAT*) { return S_OK; }
|
||||
JUCE_COMRESULT DrawUnderline (void*, FLOAT, FLOAT, DWRITE_UNDERLINE const*, IUnknown*) { return S_OK; }
|
||||
JUCE_COMRESULT DrawStrikethrough (void*, FLOAT, FLOAT, DWRITE_STRIKETHROUGH const*, IUnknown*) { return S_OK; }
|
||||
JUCE_COMRESULT DrawInlineObject (void*, FLOAT, FLOAT, IDWriteInlineObject*, BOOL, BOOL, IUnknown*) { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT GetCurrentTransform (void*, DWRITE_MATRIX* matrix)
|
||||
{
|
||||
matrix->m11 = 1.0f;
|
||||
matrix->m12 = 0.0f;
|
||||
matrix->m21 = 0.0f;
|
||||
matrix->m22 = 1.0f;
|
||||
matrix->dx = 0.0f;
|
||||
matrix->dy = 0.0f;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT GetPixelsPerDip (void*, FLOAT* pixelsPerDip)
|
||||
{
|
||||
*pixelsPerDip = 1.0f;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT DrawUnderline (void*, FLOAT, FLOAT, DWRITE_UNDERLINE const*, IUnknown*)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT DrawStrikethrough (void*, FLOAT, FLOAT, DWRITE_STRIKETHROUGH const*, IUnknown*)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT DrawInlineObject (void*, FLOAT, FLOAT, IDWriteInlineObject*, BOOL, BOOL, IUnknown*)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT DrawGlyphRun (void* clientDrawingContext, FLOAT baselineOriginX, FLOAT baselineOriginY, DWRITE_MEASURING_MODE,
|
||||
DWRITE_GLYPH_RUN const* glyphRun, DWRITE_GLYPH_RUN_DESCRIPTION const* runDescription,
|
||||
|
|
@ -419,20 +445,6 @@ bool TextLayout::createNativeLayout (const AttributedString& text)
|
|||
|
||||
if (factories->d2dFactory != nullptr && factories->systemFonts != nullptr)
|
||||
{
|
||||
#if JUCE_64BIT
|
||||
// There's a mysterious bug in 64-bit Windows that causes garbage floating-point
|
||||
// values to be returned to DrawGlyphRun the first time that it gets used.
|
||||
// In lieu of a better plan, this bodge uses a dummy call to work around this.
|
||||
static bool hasBeenCalled = false;
|
||||
if (! hasBeenCalled)
|
||||
{
|
||||
hasBeenCalled = true;
|
||||
TextLayout dummy;
|
||||
DirectWriteTypeLayout::createLayout (dummy, text, factories->directWriteFactory,
|
||||
factories->d2dFactory, factories->systemFonts);
|
||||
}
|
||||
#endif
|
||||
|
||||
DirectWriteTypeLayout::createLayout (*this, text, factories->directWriteFactory,
|
||||
factories->d2dFactory, factories->systemFonts);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue