← Back to team overview

kicad-developers team mailing list archive

Re: Patch: move newstroke definitions to separate .cpp


Manveru wrote:
> [Attachment( s) <#TopText> from Manveru included below]
> Hi,
> This patch is not ideal, as the the size of the array has to be
> declared in newstroke_font. h, because sizeof() operator is used in
> drawtxt.cpp.
> I have an idea how to modify the code to feed hashmap from array of
> glyphs we already have defined, ignoring all "F^K[KFYFY[K[ ", which may
> reduce amount of memory used to store glyphs in code (I am even
> thinking about compression, as text format used is very compressible) ,
> and make the code more objective in approach.

I do not understand *exactly* what to want to do.
There are a lot of strings initialized to "F^K[KFYFY[K[ " and pointers to these strings in newstroke_font[] but the string "F^K[KFYFY[K[ " is stored only once in memory, and all pointers in newstroke_font[] point this string. (Usually, when compilers find many times the same constant string, only one instance is created, at least with the -O2 optimization)
So compressing strings themselves is not very useful.
Of course, if you are thinking about compressing pointers themselves (that are pointing the same string, therefore identical) in newstroke_font, this is an other problem.
But is it very useful ? (compressing has also a cost).

Jean-Pierre CHARRAS

Maître de conférences
Directeur d'études 2ieme année.
Génie Electrique et Informatique Industrielle 2
Institut Universitaire de Technologie 1 de Grenoble
BP 67, 38402 St Martin d'Heres Cedex

Recherche :
Rue de la Houille Blanche
38400 Saint Martin d'Heres