Re: [PATCH] Faster glyph lookup by BMP index

2009-12-04 Thread Robert Millan
On Sun, Nov 29, 2009 at 03:29:18PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
> Hello. Basic Multilingual Plane is range of Unicode characters in
> 0-65535 and it contains most of the characters needed by most of the
> languages of the world. By keeping an array with pointers to such
> characters at the cost of 128KiB per font we can almost instantenously
> lookup characters which are likely to be used in grub. Available in
> experimental

Seems fine (for trunk as well), just one thing:

> +  grub_memset (font->bmp_idx, 0xff, 0x1 * sizeof (grub_uint16_t));
> [...]
> +  if (entry->code < 0x1)
> [...]
> +  /* Use BMP index if possible.  */
> +  if (code < 0x1)
> +{
> +  if (font->bmp_idx[code] == 0x)

Could these be macroified?  Makes it harder to do mistakes in the future.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Faster glyph lookup by BMP index

2009-11-29 Thread Vladimir 'φ-coder/phcoder' Serbinenko
richardvo...@gmail.com wrote:
> Is this table stored in the file or built during font load?  
This table is generated on file load
> 2009/11/29 Vladimir 'φ-coder/phcoder' Serbinenko :
>   
>> Hello. Basic Multilingual Plane is range of Unicode characters in
>> 0-65535 and it contains most of the characters needed by most of the
>> languages of the world. By keeping an array with pointers to such
>> characters at the cost of 128KiB per font we can almost instantenously
>> lookup characters which are likely to be used in grub. Available in
>> experimental
>>
>> --
>> Regards
>> Vladimir 'φ-coder/phcoder' Serbinenko
>>
>>
>> ___
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>>
>>
>> 
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] Faster glyph lookup by BMP index

2009-11-29 Thread richardvo...@gmail.com
Is this table stored in the file or built during font load?  128KiB in
memory is no issue at all on modern systems, 128KiB in a file is
somewhat more troublesome since it won't fit in a boot sector, is a
big chunk of a rescue diskette, and the I/O cost is noticeable.  These
glyphs are stored in sorted order in the file, correct?  May I suggest
that only every Nth index be stored in the file header (where N = 16
for example) and the intermediate ones discovered at runtime, in those
subranges containing a character actually used (and the indexes and
character data for those glyphs are then cached in memory)?  This also
means block reads from the file (block length is easily calculated as
the difference of two adjacent indices) instead of extraction of
individual characters, most languages tend to have good locality so
this should also be a win.  Or is the entire font file cached in
memory anyway?

2009/11/29 Vladimir 'φ-coder/phcoder' Serbinenko :
> Hello. Basic Multilingual Plane is range of Unicode characters in
> 0-65535 and it contains most of the characters needed by most of the
> languages of the world. By keeping an array with pointers to such
> characters at the cost of 128KiB per font we can almost instantenously
> lookup characters which are likely to be used in grub. Available in
> experimental
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
>
> ___
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel