summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
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;