From ad16ecb14a085d950b6a243b02267a0eca50f5c9 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 20 Nov 2015 10:52:27 +1100 Subject: Using DirectWrite, for ligatures and other character clusters, display caret and selections part-way through clusters so that the caret doesn't stick to the end of the cluster making it easier to understand editing actions. --- win32/PlatWin.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 79fccc22f..bf4f0503b 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1614,17 +1614,16 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION * HRESULT hr = pIDWriteFactory->CreateTextLayout(tbuf.buffer, tbuf.tlen, pTextFormat, 10000.0, 1000.0, &pTextLayout); if (!SUCCEEDED(hr)) return; - // For now, assuming WCHAR == cluster if (!SUCCEEDED(pTextLayout->GetClusterMetrics(clusterMetrics, clusters, &count))) return; + // A cluster may be more than one WCHAR, such as for "ffi" which is a ligature in the Candara font FLOAT position = 0.0f; size_t ti=0; for (size_t ci=0; ci(tbuf.tlen)); pTextLayout->Release(); -- cgit v1.2.3