[fpc-pascal] Unicode file routines proposal
Mattias Gärtner
nc-gaertnma at netcologne.de
Wed Jul 2 12:44:46 CEST 2008
Zitat von Martin Schreiber <fpmse at bluewin.ch>:
> On Wednesday 02 July 2008 11.08:31 Mattias Gärtner wrote:
> > Zitat von Martin Schreiber <fpmse at bluewin.ch>:
> > > For example lib/common/kernel/msedrawtext.pas:223, procedure layouttext.
> >
> > Nice code.
> > As far as I can see, it handles tabs, linebreaks, c_softhyphen and
> > charwidth. It uses single array element per character optimizations, like
> > the charwidths array.
> > I think I would simply keep that and define the characterwidth for the
> > follow up elements as 0.
> > Then you only need to change the places where you check for the
> > c_softhyphen. And because this is a constant you can even use some tricks
> > here.
> > I don't see how this have a big impact on the performance.
> >
> The code is complicated enough, don't you think? ;-)
Ah, sorry, now I understand.
You meant, the performance penalty of the *programmer* is not negligible
comparing ASCII/UCS-2 and UTF-8/16.
Yes, it's true, that for layout code it is often better (readability, maintance)
to refactor the code first, before extending it for UTF. Especially if it is
optimized code.
BTW, where is the layout code that handles Right-To-Left, kerning and sub pixel
rendering?
Mattias
More information about the fpc-pascal
mailing list