summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-05-01 12:02:54 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-05-01 12:02:54 (GMT)
commit641eafecd32b65ad9d8adfe6803213421a21bef8 (patch)
treee9a2ac7a0693c3517afe465567be3bea882cf06d /win/tkWinFont.c
parent5ed4790f7555c57fa47e3467c819aa111c632978 (diff)
parentf8e6b44392467bc7a6d6aba8e4f775517d3686ac (diff)
downloadtk-641eafecd32b65ad9d8adfe6803213421a21bef8.zip
tk-641eafecd32b65ad9d8adfe6803213421a21bef8.tar.gz
tk-641eafecd32b65ad9d8adfe6803213421a21bef8.tar.bz2
merge core-8-6-branch
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 91f8f14..3d38ea4 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -215,8 +215,8 @@ static int LoadFontRanges(HDC hdc, HFONT hFont,
USHORT **startCount, USHORT **endCount,
int *symbolPtr);
static void MultiFontTextOut(HDC hdc, WinFont *fontPtr,
- const char *source, int numBytes, int x, int y,
- double angle);
+ const char *source, int numBytes,
+ double x, double y, double angle);
static void ReleaseFont(WinFont *fontPtr);
static inline void ReleaseSubFont(SubFont *subFontPtr);
static int SeenName(const char *name, Tcl_DString *dsPtr);
@@ -1294,11 +1294,11 @@ TkDrawAngledChars(
*/
PatBlt(dcMem, 0, 0, size.cx, size.cy, BLACKNESS);
- MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
+ MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
0, 0, 0xEA02E9);
PatBlt(dcMem, 0, 0, size.cx, size.cy, WHITENESS);
- MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
+ MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
BitBlt(dc, (int)x, (int)y - tm.tmAscent, size.cx, size.cy, dcMem,
0, 0, 0x8A0E06);
@@ -1315,7 +1315,7 @@ TkDrawAngledChars(
SetTextAlign(dc, TA_LEFT | TA_BASELINE);
SetTextColor(dc, gc->foreground);
SetBkMode(dc, TRANSPARENT);
- MultiFontTextOut(dc, fontPtr, source, numBytes, (int)x, (int)y, angle);
+ MultiFontTextOut(dc, fontPtr, source, numBytes, x, y, angle);
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
@@ -1460,7 +1460,7 @@ MultiFontTextOut(
* following string. */
const char *source, /* Potentially multilingual UTF-8 string. */
int numBytes, /* Length of string in bytes. */
- int x, int y, /* Coordinates at which to place origin of
+ double x, double y, /* Coordinates at which to place origin of
* string when drawing. */
double angle)
{
@@ -1472,6 +1472,7 @@ MultiFontTextOut(
const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
TEXTMETRICW tm;
+ double sinA = sin(angle * PI/180.0), cosA = cos(angle * PI/180.0);
lastSubFontPtr = &fontPtr->subFontArray[0];
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
@@ -1501,7 +1502,8 @@ MultiFontTextOut(
(WCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
&size);
- x += size.cx;
+ x += cosA*size.cx;
+ y -= sinA*size.cx;
Tcl_DStringFree(&runString);
}
lastSubFontPtr = thisSubFontPtr;