aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-03-27 18:06:42 +1100
committerNeil <nyamatongwe@gmail.com>2025-03-27 18:06:42 +1100
commitc2189f99d1781b4d676ea9741052df353e0180bd (patch)
treeef9354908a84a9a7badfacdc4256c94a1b7bae13
parente9da6a78fa68f5054ab1986c355ea7c564f96096 (diff)
downloadscintilla-mirror-c2189f99d1781b4d676ea9741052df353e0180bd.tar.gz
Use constant for pointsPerInch.
-rw-r--r--win32/PlatWin.h3
-rw-r--r--win32/ScintillaWin.cxx2
-rw-r--r--win32/SurfaceD2D.cxx2
-rw-r--r--win32/SurfaceGDI.cxx2
4 files changed, 6 insertions, 3 deletions
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index 27f9b3e3d..ec39b0870 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -15,6 +15,9 @@ namespace Scintilla::Internal {
#endif
constexpr FLOAT dpiDefault = USER_DEFAULT_SCREEN_DPI;
+// Used for defining font size with LOGFONT
+constexpr int pointsPerInch = 72;
+
extern void Platform_Initialise(void *hInstance) noexcept;
extern void Platform_Finalise(bool fromDllMain) noexcept;
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 48b97766e..55e5e91f9 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -3318,7 +3318,7 @@ void ScintillaWin::ImeStartComposition() {
if (sizeZoomed <= 2 * FontSizeMultiplier) // Hangs if sizeZoomed <= 1
sizeZoomed = 2 * FontSizeMultiplier;
// The negative is to allow for leading
- lf.lfHeight = -::MulDiv(sizeZoomed, dpi, 72*FontSizeMultiplier);
+ lf.lfHeight = -::MulDiv(sizeZoomed, dpi, pointsPerInch*FontSizeMultiplier);
lf.lfWeight = static_cast<LONG>(vs.styles[styleHere].weight);
lf.lfItalic = vs.styles[styleHere].italic ? 1 : 0;
lf.lfCharSet = DEFAULT_CHARSET;
diff --git a/win32/SurfaceD2D.cxx b/win32/SurfaceD2D.cxx
index 5ebf2191a..0a3385a5b 100644
--- a/win32/SurfaceD2D.cxx
+++ b/win32/SurfaceD2D.cxx
@@ -527,7 +527,7 @@ int SurfaceD2D::PixelDivisions() {
}
int SurfaceD2D::DeviceHeightFont(int points) {
- return ::MulDiv(points, LogPixelsY(), 72);
+ return ::MulDiv(points, LogPixelsY(), pointsPerInch);
}
void SurfaceD2D::LineDraw(Point start, Point end, Stroke stroke) {
diff --git a/win32/SurfaceGDI.cxx b/win32/SurfaceGDI.cxx
index 0fcb99397..528a64573 100644
--- a/win32/SurfaceGDI.cxx
+++ b/win32/SurfaceGDI.cxx
@@ -360,7 +360,7 @@ int SurfaceGDI::PixelDivisions() {
}
int SurfaceGDI::DeviceHeightFont(int points) {
- return ::MulDiv(points, LogPixelsY(), 72);
+ return ::MulDiv(points, LogPixelsY(), pointsPerInch);
}
void SurfaceGDI::LineDraw(Point start, Point end, Stroke stroke) {