| Ticket UUID: | 228444 | |||
| Title: | Can't enumerate font families on Windows NT/2000 | |||
| Type: | Bug | Version: | obsolete: 8.3.2 | |
| Submitter: | sheltond | Created on: | 2001-01-11 15:32:28 | |
| Subsystem: | 68. Win Window Operations | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2001-03-31 01:40:52 | |
| Resolution: | Works For Me | Closed By: | hobbs | |
| Closed on: | 2001-03-30 18:40:52 | |||
| Description: |
The initialization of the Tk system creates the application window before calling TkpInit().
On windows, TkpInit() calls TkWinXInit(), which initialises the tkPlatformId variable. However, the font system is initialised during creation of the application window, and it uses this variable.
In tkWinFont.c, in function TkpFontPkgInit(), the systemEncoding variable is set to unicodeEncoding, if the value of tkPlatformId is VER_PLATFORM_WIN32_NT. However, since this is done before the tkPlatformId variable is set up, the systemEncoding variable remains set to NULL.
Later on, if you enumerate the fonts families (which calls TkpGetFontFamilies on windows), it determines that it is on NT (since the value of tkPlatformId is set up by this point), and calls the unicode version of EnumFontFamilies.
This calls the callback function with a unicode string, but the systemEncoding variable is still NULL, so the strings don't get decoded properly. What you actually get is the first character of each of the font families.
This also means that you can't set fonts properly using the form {Courier -size 8}.
I have patched this on my system as follows (in win/tkWinX.c):
Near the top:
> static int tkPlatformId=-1;
Later on:
> int TkWinGetPlatformId()
> {
> if (tkPlatformId==-1) {
> OSVERSIONINFO os;
> GetVersionEx(&os);
> tkPlatformId = os.dwPlatformId;
> }
> return tkPlatformId;
> }
| |||
| User Comments: |
hobbs added on 2001-03-31 01:40:52:
Logged In: YES user_id=72656 Please send me more info if you can repeat it. sheltond added on 2001-03-30 15:50:58: Logged In: YES user_id=111227 I think I was using the standard binaries from TclPro1.4. Also, perhaps it has been fixed between 8.3.2 and 8.4a2? Having said that, I thought I had checked in CVS and this file hadn't been modified and still contained the bug which I mentioned above. However, I now can't replicate the problem on any of my versions of Tcl, including 8.3.2 versions which I thought I hadn't patched. I am fairly convinced that the logic which I described above was correct at the time, since I tested it by single- stepping through with Visual C++, and I definitely observed the behaviour which I mentioned above. It is quite possible that it was some interaction with something else which I was doing, though. hobbs added on 2001-03-30 13:56:37: Logged In: YES
user_id=72656
Eh? I find that this works just fine:
>Main< (hobbs) 49 % font families
System Terminal Fixedsys Roman Script Modern {Small Fonts}
{MS Serif} Courier {MS Sans Serif} 6x13 cursor nil2 6x13b
7x13b HELVB12 Marlett Arial {Arial CE} {Arial CYR} {Arial
Greek} {Arial TUR} {Arial Baltic} {Courier New} {Courier
New CE} {Courier New CYR} {Courier New Greek} {Courier New
TUR} {Courier New Baltic} {Lucida Console} {Lucida Sans
Unicode} {Times New Roman} {Times New Roman CE} {Times New
Roman CYR} {Times New Roman Greek} {Times New Roman TUR}
{Times New Roman Baltic} Wingdings Symbol Verdana {Arial
Black} {Comic Sans MS} Impact Georgia {Palatino Linotype}
Tahoma {Trebuchet MS} Webdings {Microsoft Sans Serif}
{Arial Narrow} {Book Antiqua} {Bookman Old Style} {Century
Gothic} Garamond {MS Outlook} {Wingdings 2} {Wingdings 3}
Batang @Batang Haettenschweiler {Monotype Corsiva}
>Main< (hobbs) 50 % info patch
8.4a2
Perhaps you are having problems when building Tk into
something? Did you also call Tcl_FindExecutable?
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki