summaryrefslogtreecommitdiff
path: root/core/fxge/win32
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/win32')
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp
index b79de57db2..6c4b8ec6f3 100644
--- a/core/fxge/win32/cfx_psrenderer.cpp
+++ b/core/fxge/win32/cfx_psrenderer.cpp
@@ -6,6 +6,7 @@
#include "core/fxge/win32/cfx_psrenderer.h"
+#include <algorithm>
#include <memory>
#include <sstream>
@@ -639,15 +640,19 @@ bool CFX_PSRenderer::DrawText(int nChars,
const CFX_Matrix* pObject2Device,
float font_size,
uint32_t color) {
- // Do not send zero or negative font sizes to printers. See crbug.com/767343.
- if (font_size <= 0.0)
- return true;
-
+ // Check object to device matrix first, since it can scale the font size.
if ((pObject2Device->a == 0 && pObject2Device->b == 0) ||
(pObject2Device->c == 0 && pObject2Device->d == 0)) {
return true;
}
+ // Do not send near zero font sizes to printers. See crbug.com/767343.
+ float scale =
+ std::min(pObject2Device->GetXUnit(), pObject2Device->GetYUnit());
+ static constexpr float kEpsilon = 0.01f;
+ if (std::fabs(font_size * scale) < kEpsilon)
+ return true;
+
StartRendering();
int alpha = FXARGB_A(color);
if (alpha < 255)