Commit graph

62 commits

Author SHA1 Message Date
Solomon Peachy
a2c10f6189 unicode: Support characters beyond the first unicode plane
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * font manipulation, caching, rendering, and generation
 * on-screen keyboard
 * FAT filesystem (parsing and generating utf16 LFNs)
 * WIN32 simulator platform code

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Appears to work on:

  * hosted linux, native, linux simulator in both 16/32-bit modes.

Needs testing on:

  * windows and macos simulator (16bit+32bit)

Change-Id: Iba111b27d2433019b6bff937cf1ebd2c4353a0e8
2025-09-12 09:24:30 -04:00
Solomon Peachy
84504c7471 Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b.
2025-08-20 16:09:49 -04:00
Solomon Peachy
d05c59f35b internals: Support characters beyond the first unicode plane (WIP)
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * on-screen keyboard
 * font manipulation, caching, rendering, and generation
 * VFAT code parses and generates utf16 dirents
 * WIN32 simulator reads and writes utf16 filenames

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Known bugs:

  * Native players in 32-bit unicode mode generate mangled filename
    entries if they include UTF16 surrogate codepoints.  Root cause
    is unclear, and may reside in core dircache code.

Needs testing on:

 * windows simulator (16bit+32bit)

Change-Id: I193a00fe2a11a4181ddc82df2d71be52bf00b6e6
2025-08-20 16:08:43 -04:00
Solomon Peachy
33c74d948c convbdf: Replace magic number with #define shared with main code
Change-Id: Id46d5f2fe88fdaac94d00b1a4810ab161baad35b
2025-05-23 18:55:11 -04:00
Solomon Peachy
d1ffaa8949 convbdf: Properly support a compiled sysfont of over 64K.
The 'struct font' definition says:

    const void *offset;           /* offsets into bitmap data,
                                     uint16_t if bits_size < 0xFFDB else uint32_t*/

However convbdf was unconditionally using 'unsigned short' without
checking bits_size. This generated a bogus table if used with an
uncapped SYSFONT due to offeset overflows.  And a pile of complier
warnings.

That said, we're still capping SYSFONT at 255 chars due to space
constraints -- 14-Rockbox-mix jumps from 2.6K to 1022K if left
uncapped.  Yowza.

Change-Id: I4577da08ab1633ab7abbc167523196f38c8a348a
2024-11-06 09:40:06 -05:00
Solomon Peachy
658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Thomas Martitz
77ee2851de Fix warnings. convbdf needed to be updated for the changed font struct because it generates sysfont.c.
Change-Id: Id5aea6b6c73438242a80ae6849ee5e29ab8659dc
2014-01-26 15:02:11 +01:00
Fred Bauer
ea7a89606c FS#12293 Global default glyph setting in System > Limits > Glyphs To Cache. Defaults to 250. This saves a lot of RAM while still allowing non-English users to have adequate glyph coverage.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31031 a1c6a512-1295-4272-9138-f99709370657
2011-11-19 23:34:26 +00:00
Fred Bauer
2a478c826b Split long fmt string which caused a yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30770 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 13:29:16 +00:00
Fred Bauer
8c9017211e Faster cached font loading. FS#12333
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30769 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 13:17:04 +00:00
Fred Bauer
f0311d3310 Update convbdf.c for previous change
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30764 a1c6a512-1295-4272-9138-f99709370657
2011-10-16 20:29:57 +00:00
Thomas Martitz
29e84dff51 Remove a few whitespaces to get under the magical string length of 509 (i.e. fix yellow)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29524 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 18:56:47 +00:00
Thomas Martitz
9edd6d4ee9 Anti-Aliased Fonts support.
This enables Rockbox to render anti-aliased fonts using an alpha blending method.
The input font bitmaps are 4bit, i.e. 4x larger, but the metadata size stays the same.

A tool, convttf, for converting ttf fonts directly to the Rockbox fnt format is provided.
It has a useful help output, but the parameter that works best is -c1 or -c2 (2 for larger font sizes).

Flyspray: FS#8961
Author: Initial work by Jonas Hurrelmann, further work by Fred Bauer, Andrew Mahone, Teruaki Kawashima and myself.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29523 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 18:36:51 +00:00
Alexander Levin
5f6e43d15b More explanation to the convbdf options
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27510 a1c6a512-1295-4272-9138-f99709370657
2010-07-21 19:33:16 +00:00
Alexander Levin
949d99546e Improve spacing in comments in convbdf; rename a local variable which can be confused with 1 (one)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26117 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 20:55:55 +00:00
Alexander Levin
2ed7745dde Fix convbdf: now .c and .fnt files can be generated in one run again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26115 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 20:37:45 +00:00
Alexander Levin
2e8bd81d4d Improve spacing in comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26091 a1c6a512-1295-4272-9138-f99709370657
2010-05-16 15:15:29 +00:00
Alexander Levin
573409193b Generating .c file make internal data structures unusable so that .fnt file can not be produced after that. Make sure that both options are not used at the same time. Better fix would be to adjust the function that generates .c file, but it would require more time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26001 a1c6a512-1295-4272-9138-f99709370657
2010-05-13 21:27:42 +00:00
Jonathan Gordon
1c2aa35371 FS#10984 - multifont! 2 major additions:
1) seperate UI font for the remote and main displays
2) allow individual skins to load additional fonts for use in the skin (Uo to 7 extra in this first version) see CustomWPS for info on how to load a font in the skins.

Code should always use FONT_UI+screen_number to get the correct user font


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24644 a1c6a512-1295-4272-9138-f99709370657
2010-02-14 06:26:16 +00:00
Alexander Levin
549fc95b8d Remove the (part of the) check that is actually not needed since the 'properties' section is optional
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20831 a1c6a512-1295-4272-9138-f99709370657
2009-04-30 05:07:45 +00:00
Alexander Levin
ecd4394f62 Allow to specify DWIDTH at font level making DWIDTH at char level optional (FS#10176 by Yoshihisa Uchida with minor modifications by me)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20828 a1c6a512-1295-4272-9138-f99709370657
2009-04-29 21:51:04 +00:00
Alexander Levin
d88a58bddd Make error message more informative; increase the max size of rotatable glyphs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20321 a1c6a512-1295-4272-9138-f99709370657
2009-03-13 18:56:55 +00:00
Alexander Levin
d59e310375 Provide information about how the font could be reduced without glyph clipping
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20307 a1c6a512-1295-4272-9138-f99709370657
2009-03-12 19:55:07 +00:00
Alexander Levin
28a4c73bc4 Add a TODO mark -- code duplication is ugly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20257 a1c6a512-1295-4272-9138-f99709370657
2009-03-09 21:09:26 +00:00
Alexander Levin
bded5db2d9 Introduced new options for convbdf that specify how the ascent/descent is allowed to grow to avoid glyph clipping.
The syntax is (for ascent, descent is similar): N[%][!]. E.g. -a3 allows ascent to become 3 pixels greater; -a3! forces ascent to become 3 px greater; -a20% allows ascent to grow 20% from what is specified in the font.
By default, ascent/descent are not allowed to grow.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20239 a1c6a512-1295-4272-9138-f99709370657
2009-03-08 16:23:14 +00:00
Alexander Levin
537ee27384 Unify printing of warnings/errors/info messages
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20231 a1c6a512-1295-4272-9138-f99709370657
2009-03-07 22:09:00 +00:00
Alexander Levin
031ac442c5 Only print clip warnings in verbose mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20222 a1c6a512-1295-4272-9138-f99709370657
2009-03-06 23:32:08 +00:00
Alexander Levin
2af0b60aaa Remove the check since it can fail if the chars to process were limited per command line options.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20221 a1c6a512-1295-4272-9138-f99709370657
2009-03-06 23:18:47 +00:00
Alexander Levin
cbcef6700c Revamp of the bitmap allocation for the fonts. Implements the idea from FS#9907 (reallocate when maxwidth grows), but does it correctly. Also gets rid of the warning "DWIDTH spec > ..." which is irritating since the bounding box header of the font is not required to specify the MAX width.
Also replaced TABs with spaces.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20219 a1c6a512-1295-4272-9138-f99709370657
2009-03-06 22:50:47 +00:00
Alexander Levin
5aca36115f Use plaint int here since it's also used for the other fields
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20211 a1c6a512-1295-4272-9138-f99709370657
2009-03-05 23:09:19 +00:00
Alexander Levin
2bbfd6f4ff Provide better stats (print the total number of glyphs as well)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20210 a1c6a512-1295-4272-9138-f99709370657
2009-03-05 23:06:00 +00:00
Alexander Levin
7c93b5cb60 Correct the char's bby and bbh if it's clipped
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20207 a1c6a512-1295-4272-9138-f99709370657
2009-03-05 21:27:55 +00:00
Alexander Levin
67c6f6048e Clip the glyphs that wouldn't be correctly rendered by Rockbox thus avoiding "noise" in glyphs. See also the attachment in FS#9931 for the list of
the "offending" fonts. Further steps would be to decide how such fonts can be handled better.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20204 a1c6a512-1295-4272-9138-f99709370657
2009-03-04 21:42:26 +00:00
Jonathan Gordon
f5be029854 Fix one of the warnings which the ubuntu 8.10 servers are throwing..
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19576 a1c6a512-1295-4272-9138-f99709370657
2008-12-24 04:44:28 +00:00
Daniel Stenberg
10080b8420 decrease the risk of an overflow due to typecase from unsigned to signed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17065 a1c6a512-1295-4272-9138-f99709370657
2008-04-10 21:49:40 +00:00
Daniel Stenberg
59875c33bf and fix yet another picky warning
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17063 a1c6a512-1295-4272-9138-f99709370657
2008-04-10 21:41:29 +00:00
Daniel Stenberg
5d62f2ce8e oops
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17062 a1c6a512-1295-4272-9138-f99709370657
2008-04-10 21:25:54 +00:00
Daniel Stenberg
afecfe46f3 cleanup code for picky compiler warning options
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17060 a1c6a512-1295-4272-9138-f99709370657
2008-04-10 21:16:00 +00:00
Michael Giacomelli
24dacb6f58 Remove old debug statement when building fonts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16143 a1c6a512-1295-4272-9138-f99709370657
2008-01-22 15:55:21 +00:00
Daniel Stenberg
44a8713bfe FS#4955 - convbdf segfaults on very large fonts was simply due to a too small
destination buffer and no bounds check in the code. I've now enlarged the
buffer and added a bounds check. Case closed.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14093 a1c6a512-1295-4272-9138-f99709370657
2007-07-31 09:42:50 +00:00
Barry Wardell
8d991e7601 Fix build warnings and errors.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12044 a1c6a512-1295-4272-9138-f99709370657
2007-01-17 12:53:23 +00:00
Barry Wardell
f4709d0c7c Make the build system create a sysfont.h which includes font information for the system font. Available #defines are: SYSFONT_NAME, SYSFONT_FACENAME, SYSFONT_WIDTH, SYSFONT_HEIGHT, SYSFONT_SIZE, SYSFONT_ASCENT, SYSFONT_DESCENT, SYSFONT_FIRST_CHAR, SYSFONT_LAST_CHAR, SYSFONT_DEFAULT_CHAR, SYSFONT_PROPORTIONAL, SYSFONT_COPYRIGHT, SYSFONT_BITS_SIZE.
Also fix a small bug in the iPod bootloader printf() code and use printf() for PortalPlayer bootloaders too.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12041 a1c6a512-1295-4272-9138-f99709370657
2007-01-17 12:20:38 +00:00
Frank Dischner
359189efe3 Fix bug with fonts containing missing glyphs before default glyph. Also, allow fonts with trailing space on BITMAP line.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9719 a1c6a512-1295-4272-9138-f99709370657
2006-04-18 17:24:14 +00:00
Daniel Stenberg
dcc9a8a3d8 Use 'int' for 32 bit variables in host tools to better run on 64bit archs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8626 a1c6a512-1295-4272-9138-f99709370657
2006-02-08 13:05:37 +00:00
Magnus Holmgren
d8dcc25fdf Fix crash when converting the font 00-Starmap_r400-8.bdf.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8203 a1c6a512-1295-4272-9138-f99709370657
2005-12-08 19:25:15 +00:00
Marcoen Hirschberg
b0fee17d6e waiting is over: initial unicode commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8169 a1c6a512-1295-4272-9138-f99709370657
2005-12-06 13:27:15 +00:00
Magnus Holmgren
a199aef53a Applied patch 1342470: Support fonts wider than 16 pixels in convbdf.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7874 a1c6a512-1295-4272-9138-f99709370657
2005-11-14 19:52:04 +00:00
Linus Nielsen Feltzing
985ae73758 Moved the declaration of the ofr variable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7435 a1c6a512-1295-4272-9138-f99709370657
2005-08-31 17:26:22 +00:00
Daniel Stenberg
2d2b1e7cd5 patch #1267220 by Frank - phaedrus961
Currently convbdf will sort the bits order in the order of the encoding when
creating the .c or .fnt file, but it doesn't update the offsets. This patch
makes sure the offsets are updated along with the bits, so that fonts with out
of order glyphs display properly.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7392 a1c6a512-1295-4272-9138-f99709370657
2005-08-23 21:38:26 +00:00
Linus Nielsen Feltzing
5aeaed8aff convbdf: fixed a problem with 16 pixel wide characters. It now also refuses to convert fonts with >16 pixel characters, since it can't yet convert them correctly (bitmap_t is 16 bits wide).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7295 a1c6a512-1295-4272-9138-f99709370657
2005-08-09 23:05:35 +00:00