summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-17 08:51:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-17 08:51:55 (GMT)
commitaf123e3f03048a5013a6802a06321f1386efe71d (patch)
tree8aaef324a6bcd923c54628b876709f11fe0fabc8 /win
parent9b2958c5803abffb4174f28adac63058409ded8e (diff)
parent862f1a276482cc4ca6bf3d1f03709ab1e270c349 (diff)
downloadtk-af123e3f03048a5013a6802a06321f1386efe71d.zip
tk-af123e3f03048a5013a6802a06321f1386efe71d.tar.gz
tk-af123e3f03048a5013a6802a06321f1386efe71d.tar.bz2
Merge 8.6
Diffstat (limited to 'win')
-rw-r--r--win/tkWinFont.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 948ca10..35a9941 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -26,10 +26,10 @@
* Under Windows, a "font family" is uniquely identified by its face name.
*/
-#define FONTMAP_SHIFT 12
+#define FONTMAP_SHIFT 10
-#define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT))
#define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT)
+#define FONTMAP_PAGES (0x30000 / FONTMAP_BITSPERPAGE)
typedef struct FontFamily {
struct FontFamily *nextPtr; /* Next in list of all known font families. */
@@ -1943,7 +1943,7 @@ FindSubFontForChar(
SubFont *subFontPtr;
Tcl_DString ds;
- if (ch < BASE_CHARS) {
+ if ((ch < BASE_CHARS) || (ch >= 0x30000)) {
return &fontPtr->subFontArray[0];
}
@@ -2115,6 +2115,10 @@ FontMapLookup(
{
int row, bitOffset;
+ if (ch < 0 || ch >= 0x30000) {
+ return 0;
+ }
+
row = ch >> FONTMAP_SHIFT;
if (subFontPtr->fontMap[row] == NULL) {
FontMapLoadPage(subFontPtr, row);
@@ -2155,12 +2159,14 @@ FontMapInsert(
{
int row, bitOffset;
- row = ch >> FONTMAP_SHIFT;
- if (subFontPtr->fontMap[row] == NULL) {
- FontMapLoadPage(subFontPtr, row);
+ if (ch >= 0 && ch < 0x30000) {
+ row = ch >> FONTMAP_SHIFT;
+ if (subFontPtr->fontMap[row] == NULL) {
+ FontMapLoadPage(subFontPtr, row);
+ }
+ bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
+ subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
}
- bitOffset = ch & (FONTMAP_BITSPERPAGE - 1);
- subFontPtr->fontMap[row][bitOffset >> 3] |= 1 << (bitOffset & 7);
}
/*
@@ -2528,6 +2534,22 @@ FamilyExists(
int result;
Tcl_DString faceString;
+ /*
+ * Just immediately rule out the following fonts, because they look so
+ * ugly on windows. The caller's fallback mechanism will cause the
+ * corresponding appropriate TrueType fonts to be selected.
+ */
+
+ if (strcasecmp(faceName, "Courier") == 0) {
+ return 0;
+ }
+ if (strcasecmp(faceName, "Times") == 0) {
+ return 0;
+ }
+ if (strcasecmp(faceName, "Helvetica") == 0) {
+ return 0;
+ }
+
Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString);
/*