ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-mac
tcl-mac
Re: [MACTCL] Re: unicode/tkinter difficulties on macosx
by Revar Desmera other posts by this author
Dec 14 2005 2:01PM messages near this date
Re: [MACTCL] Re: unicode/tkinter difficulties on macosx | Re: [MACTCL] Re: unicode/tkinter difficulties on macosx
I was taking a look at fixing the current text drawing routines,  
trying to figure out why they wouldn't draw unicode.  It appears that  
the code to determine if a character is in a font will just always  
assume the character exists, if the font is an outline font.   
Something in the comments about the resource info being too complex.   
This meant it'd choose the first outline font it ran across, more or  
less, for any character it didn't otherwise know.  Even if the font  
didn't have that character.

So I got a copy of the spec for the data structures involved, and  
wrote a couple routines to parse them out properly, at least for  
version 4 SFNT data blocks.  My testing proved that this covered  
pretty much all OS X outline fonts, except for '.LastChance' or  
somesuch.

I'm pretty sure it now knows when a character is in a font.  It now  
chooses the correct font for a character, but when it goes to draw  
it, it draws garbage again.  Meh.  This is the state I currently have  
it in, as of my last debug session.  I suspect I'm not properly  
handling encoding, or something similar, but I haven't had a chance  
to verify yet.

I was avoiding the ATSUI patch because of the speed issues with  
setting up TextLayout objects.  I may take a look at that, though, to  
see if caching them may be viable.  I suspect we should be moving to  
ATSUI anyways, to get away from the QuickDraw API.

	- Revar



On Dec 14, 2005, at 8:10 AM, james tittle wrote:

>  ...I'd also like to chime in here that the ATSUI patch is really  
>  nice, and it would be a great help to me if it were fixed up for  
>  cvs:  I've basically halted most of my conversion of aqua tk to  
>  coregraphics n'friends until such a time...the reason for that is  
>  that I do have replacements for the copybits() stuff, but in  
>  quickdraw things tend to go upside down now and again, whereas if  
>  the atsui patch is in, we can probably do without the upside-down  
>  transformations necessary when converting between gworlds and  
>  cgcontext's...
> 
>  ...sadly, ben seems to be the only one guts-y enough to tackle  
>  this :-(
> 
>  jamie
> 
>  On Dec 14, 2005, at 9:15 AM, Alastair Davies wrote:
> 
> > I tried this out at the weekend for the first time.  Vincent's  
> > right that the patch applies cleanly to Tk 8.4.9 and not to later  
> > versions, but I don't think it would be all that difficult to make  
> > the changes by hand: only one or two hunks failed.
> >
> > For myself, I was absolutely amazed at the improvement in the  
> > quality of the text display with the patch applied.  I remember  
> > that some concern was expressed about the speed of the display  
> > (though in my applications this was not a problem at all) which is  
> > why the patch has not been applied to the CVS.  If it isn't too  
> > difficult to re-work the patch to this end, perhaps the best  
> > solution would be to allow ATSU to be turned on or off from the  
> > script, rather like we do for anti-aliased text or QuickDraw  
> > graphics.
> >
> > In the meantime, those not using it are definitely missing out on  
> > a wonderful piece of work.
> >
> > Alastair
> >
> > vincent rioux wrote:
> >> re,
> >> well, please disregard my last email, i just tried to compile  
> >> 8.4.9 considering the release date of the atsu8.4 patch, and it  
> >> is actually working nicely!
> >> many thanks for the tips,
> >> vincent
> >>
> >> vincent rioux wrote:
> >>> Hi Alastair,
> >>> Just tried to compile tcltk with Benjamin's patch for unicode  
> >>> fonts display.
> >>> Tried it with 8.4.12 and then 8.4.10 with no success.
> >>> With the patch on tk8.4.10, i get numerous errors of non  
> >>> declared symbols.
> >>> Worse, without the patch i still can't compile tcltk8.4.10, at  
> >>> the very last compillation step, i get this:
> >>> ld: warning prebinding disabled because of undefined symbols
> >>> ld: Undefined symbols:
> >>> _TkpMeasureCharsInContext
> >>> _TkpDrawCharsInContext
> >>> I guess i must be wrong somewhere.
> >>> Is there a version of tcltk that is known to compile on 10.3  
> >>> with this patch?
> >>> best regards,
> >>> vincent
> >>>
> >>>
> >>> Alastair Davies wrote:
> >>>> vincent, My understanding is that at present TkAqua cannot draw  
> >>>> all Unicode characters, but that Benjamin Riefenstahl has  
> >>>> developed a patch (see message below) to enable it to do so. I  
> >>>> hope this helps, Kind regards, Alastair -----Original  
> >>>> Message----- From: Benjamin Riefenstahl Sent: 18 March 2005  
> >>>> 14:09 Subject: Re: [MACTCL] Unicode in Aqua Tk Hi Linus, "Linus  
> >>>> Nyberg" writes:
> >>>>> I read something about ATSU not being easily pluggable into  
> >>>>> the Tk structure, but I just want to know what the current  
> >>>>> status is...
> >>>> Unicode doesn't work satifactorily with the QuickDraw API used  
> >>>> in the current Tk source. I wrote a patch for using ATSU  
> >>>> instead, see <http://sourceforge.net/tracker/? 
> >>>> group_id=12997&atid=312997&func=detail&aid= 638966>. This  
> >>>> implementation is slower than the QuickDraw based stuff in some  
> >>>> situations, so I am working on optimizations, before this can  
> >>>> go into CVS. Unfortunately, optimizing and testing is going  
> >>>> slow and I can only devote limited time to it. benny ----- 
> >>>> Original Message----- From: vincent rioux Sent: 19 October 2005  
> >>>> 12:24 thank you for your reply. well, i already tried to change  
> >>>> of font, but still it won't take this index.  
> >>>> ------------------------------------------------------------------ 
> >>>> -- from Tkinter import * import tkFont root = Tk() myFont =  
> >>>> tkFont.Font(size=24, family='Junicode') w = Label(root,  
> >>>> text=u'\u0254', font=myFont) w.pack() root.mainloop()  
> >>>> ------------------------------------------------------------------ 
> >>>> -- you can find junicode on the web: http:// 
> >>>> www.engl.virginia.edu/OE/junicode/junicode.html for the code of  
> >>>> the character I wanted to display : http:// 
> >>>> www.engl.virginia.edu/OE/junicode/docs/junicode_ipa.html by  
> >>>> advance many thanks vincent Russell E. Owen wrote: In article  
> >>>> <4354C5DE.5030003@[...].org>,  vincent rioux <vincent.rioux@no- 
> >>>> log.org> wrote: w = Label(root, text=u'\u0254') ... This should  
> >>>> display an 'open o' of the IPA. It happens to work with python  
> >>>> from FINK (hence using x11) but I just can't get it to work on  
> >>>> pythonw2.4/tcl-tk acqua. It will only display an empty  
> >>>> square.... My guess is that the font you are using is missing  
> >>>> the character in question. Try setting the font of the widget  
> >>>> to something with a richer character set. -- Russell  
> >>>> ------------------------------------------------------- This  
> >>>> SF.Net email is sponsored by: Power Architecture Resource  
> >>>> Center: Free content, downloads, discussions, and more. http:// 
> >>>> solutions.newsforge.com/ibmarch.tmpl  
> >>>> _______________________________________________ Tcl-mac mailing  
> >>>> list Tcl-mac@[...].net https:// 
> >>>> lists.sourceforge.net/lists/listinfo/tcl-mac
> >>>
> >>
> 
> 
> 
>  -------------------------------------------------------
>  This SF.net email is sponsored by: Splunk Inc. Do you grep through  
>  log files
>  for problems?  Stop!  Download the new AJAX search engine that makes
>  searching your log files as easy as surfing the  web.  DOWNLOAD  
>  SPLUNK!
>  http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>  _______________________________________________
>  Tcl-mac mailing list
>  Tcl-mac@[...].net
>  https://lists.sourceforge.net/lists/listinfo/tcl-mac



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Tcl-mac mailing list
Tcl-mac@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-mac
Thread:
Russell E. Owen
Vincent Rioux
Alastair Davies
Vincent Rioux
Vincent Rioux
Alastair Davies
James Tittle
Revar Desmera
Vincent Rioux
Alastair Davies

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved