rockbox/apps/plugins/text_viewer
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
..
readme.txt Remove some SWCODEC artifacts 2020-11-14 19:20:33 -05:00
SOURCES
text_viewer.c FS#13434: Partially internationalize the textviewer plugin 2024-06-11 09:53:40 -04:00
text_viewer.make
tv_action.c FS#13434: Partially internationalize the textviewer plugin 2024-06-11 09:53:40 -04:00
tv_action.h
tv_bookmark.c FS#13434: Partially internationalize the textviewer plugin 2024-06-11 09:53:40 -04:00
tv_bookmark.h
tv_button.h New port: Anbernic RG Nano 2025-07-29 21:01:53 -04:00
tv_display.c textviewer: Workaround for musl libc 2025-08-26 17:20:43 -04:00
tv_display.h
tv_menu.c mikmod: Settings names should _NOT_ be i18n'd. 2024-06-11 10:13:40 -04:00
tv_menu.h
tv_pager.c fix warnings on some systems / format specifier mismatch 2024-12-07 11:07:44 -05:00
tv_pager.h
tv_preferences.c
tv_preferences.h
tv_reader.c
tv_reader.h
tv_screen_pos.c
tv_screen_pos.h
tv_settings.c
tv_settings.h
tv_text_processor.c unicode: Support characters beyond the first unicode plane 2025-09-12 09:24:30 -04:00
tv_text_processor.h
tv_text_reader.c
tv_text_reader.h
tv_window.c
tv_window.h

About the text viewer plugin.

Limitation
    for targets where PLUGIN_BUFFER_SIZE < 0x13000,
    Only 999 pages can be read.
    


Difference between viewer.rock
    [settings file]
       - the global setting, 'tv_global.dat' is stored.
       - Settings and bookmarks for each file, 'tv_file.dat' is stored.

      Note: when viewer.dat(viewer_file.dat) exists, tv_global.dat(tv_file.dat) is created by
            using viewer.dat(viewer_file.dat).

    [word wrap]
          - add the following characters which can be split the line.
                '!', ',', '.', ':', ';', '?', 
                U+00b7, U+2010, U+3000, U+3001, U+3002, U+30fb, U+30fc, 
                U+ff01, U+ff0c, U+ff0d, U+ff0e, U+ff1a, U+ff1b, U+ff1f.

          - when the line split, if the line length is short ( < 0.75 * display width), 
            split the line in display width. (thus, maybe split a word)

    [line mode]
       [join]
           - break line condition has changed.
               - If the next line is a blank line or spaces only line, this line breaks.

       [reflow]
           - indent changes is two spaces (changable in the settings).

    [bookmark]
           - increased the number of bookmarks that can be registered to 16.


TODO list
  - for the target which PLUGIN_BUFFER_SIZE < 0x13000,   
    support more than 999 pages of text.

  - add History feature.

  - draw images that are linked to the text. (<img src="...">)

  - play audios that are linked to the text. (<audio src="...">)

  - more treatments of line breaking, word wrappings.
    (for example, period does not appear the top of line.)