summaryrefslogtreecommitdiffstats
path: root/firmware/font.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-24[BugFix] yesno screen disappearsWilliam Wilgus1-1/+1
sending GUI_EVENT_NEED_UI_UPDATE ensured we got redrawn but it also sometimes resulted in the yesno screen being overdrawn depending on which event callback was called last now increasing the update frequency, clear the dirty bit on whatever vp we are replacing and well as call our redraw function instead of sending UI_UPDATE also found a potential bug in get_font() Change-Id: I1da6defa6db799a4778590daa0c107aba00a9d34
2023-07-08font.c: Fix regression introduced in a749a95Christian Soffke1-2/+0
Index was increased by 2 instead of by 1 in each loop iteration Change-Id: I58d6957d46880f4207421b79c3ea6aa6660fbde4
2023-02-15font.c cleanupWilliam Wilgus1-29/+22
find_font_index can use font_filename_matches_loaded_id() font_path_to_glyph_path doesn't need strcat Change-Id: I8d1d36a68abbc700078d651eed930035641b6240
2023-02-15font.c return false if id is out of range instead of NULLWilliam Wilgus1-8/+8
forgot to change this to match the bool return Change-Id: I2cc6dc985b07f2bc0ae493b060aff6105f329097
2023-02-15[BugFix] font.c filename was movableWilliam Wilgus1-25/+21
stupid bug on my part font_filename was pointing to a movable alloc therefore that data could be moved out from under the returned pointer instead pin the internal calls to core_get_data and remove font_filename in favor of a function that checks if a filename matches the loaded font as this was all it was used for anyway Change-Id: Iebb47ffe3f81aa9d5e3968975f26d64283633ffc
2023-01-30font.c dynamic path nameWilliam Wilgus1-8/+25
only alloc enough space for the path instead of a fixed buffer round up the path buffer size to slightly more thna the longest common path length to reduce reallocations Change-Id: I51b8b17584d6a905ea3a66a7c38b7b1b9da2e786
2023-01-13Remove buflib allocation names, part twoAidan MacDonald1-1/+1
Remove allocation names from the buflib API and fix up all callers. Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-13Avoid using buflib names for storing font pathsAidan MacDonald1-5/+22
Naming your allocations is more of a debugging feature; it's a bad idea to abuse this feature for storing some random string. The font code does exactly that to remember the path used to load a font, and it's the only code that uses buflib names in this way. Store the path inside the font allocation instead as a regular char array. For simplicity it's MAX_PATH sized, so this'll use a bit more memory than the buflib name method, maybe 1-2 KiB if a few fonts are loaded. Change-Id: Ie286a1a273d6477af9e5d3f76e0534b62f72e8f7
2022-11-14replace strlcpy with strmemccpyWilliam Wilgus1-1/+1
replace applicable calls to strlcpy with calls to strmemccpy which null terminates on truncation in theory the strmemccpy calls should be slightly faster since they don't traverse the rest of the source string on truncation but I seriously doubt there is too much of that going on in the code base Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2
2022-11-12make splash split on control charactersWilliam Wilgus1-6/+18
splits on spaces also considers \r\n\f\v\t as mandatory breaks I'm still working on the strptokspn function my goal is to use it directly rather than storing the matched char and modifying the source string with \0 in order to tokenize the output --Done Change-Id: I7f378b5b9c4df8f10899b9a55a98950afb3931dc
2022-10-16Convert a number of allocations to use buflib pinningAidan MacDonald1-10/+6
Several places in the codebase implemented an ad-hoc form of pinning; they can be converted to use buflib pinning instead. Change-Id: I4450be007e80f6c9cc9f56c2929fa4b9b85ebff3
2022-10-15move buflib_free invalid handle check to the functionWilliam Wilgus1-2/+1
allow buflib_free to check for invalid or already freed handles within the function -- remove all the invalid handle guards thru core_free Change-Id: Ibdcbc82760fc93b674c42283fca420d94907df8e
2021-04-10misc: Only include rbpaths.h and string-extra.h in places that need itSolomon Peachy1-0/+1
(Don't include rbpaths.h in settings.h, or string-extra.h in rbpaths.h) Build-tested on rocker, erosq, mini2g, nano2g, xduoox3, clipzip, dx50, and uisim Change-Id: If32e9c9910f5c8247a655cb64522b84d6d7ccbb5
2021-02-27Rename symbols of FiiO M3K Linux-based portAidan MacDonald1-1/+1
Mainly a straight replacement of FIIO_M3K -> FIIO_M3K_LINUX. Change-Id: Id07c84f8150991d1b6851540c2c3f8f67e3f12c2
2020-10-11New port: AIGO EROS Q / EROS KSolomon Peachy1-1/+1
The Q and K have a slightly different case, but the hardware under the shell is completely identical. These models are rebadged versions: * Hifiwalker H2 (== Q) * AGPTek H3 (== K) * Surfans F20 (== K) Other notes: * Significant improvements in the shared Hiby-platform launcher/loader * SD card can theoretically be hot-swapped now * Support external USB mass storage! * Some consolidation of Hiby-platform targets * Some consolidation of plugin keymaps Todo/known issues: * Keymaps need to be gone over properly * Convert to HAVE_SCROLLWHEEL? Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
2017-09-05Initial commit for the Sony NWZ linux portAmaury Pouly1-1/+1
SUPPORTED SERIES: - NWZ-E450 - NWZ-E460 - NWZ-E470 - NWZ-E580 - NWZ-A10 NOTES: - bootloader makefile convert an extra font to be installed alongside the bootloader since sysfont is way too small - the toolsicon bitmap comes from the Oxygen iconset - touchscreen driver is untested TODO: - implement audio routing driver (pcm is handled by pcm-alsa) - fix playback: it crashes on illegal instruction in DEBUG builds - find out why the browser starts at / instead of /contents - implement radio support - implement return to OF for usb handling - calibrate battery curve (NB: of can report a battery level on a 0-5 scale but probabl don't want to use that ?) - implement simulator build (we need a nice image of the player) - figure out if we can detect jack removal POTENTIAL TODOS: - try to build a usb serial gadget and gdbserver Change-Id: Ic77d71e0651355d47cc4e423a40fb64a60c69a80
2014-01-26fonts: Fix regression(s) caused by c23ce62.Thomas Martitz1-17/+12
The builtin sysfont does not have an associated buflib_alloc_data (because it's builtin right?). font_get_{width,bits} accessed a field of it for all fonts which crashed on some systems but not on mine. Solution: Move this field to struct font directly. The cache size calculated was also busted. Fixes FS#12944 and most likely FS#12938. Change-Id: I32303c4335a12a6c421fdca34f7ece851aac12ca
2014-01-16Fix red. Screw those last-minute changes :\Thomas Martitz1-1/+1
Change-Id: I12666e98114e490a13023af7149fc37147d4e864
2014-01-16font: Fix crash due to uninitialized field.Thomas Martitz1-1/+2
Change-Id: If2fafb15a9998eebb2936e819507758e003abe30
2014-01-15fonts: Do not unload completely on USB.Thomas Martitz1-12/+104
The font engine can now perform cache lookups even if the font file is closed, if the font was disabled with the new font_disable_all() function. It is highly probable that the lookup succeeds but in the cache-miss case a blank, full-width glyph will be returned. Change-Id: I3c97e747d2a0ba30c7b495c6118c9f029d265b56
2014-01-05Do not include kernel.h in system.h.Thomas Martitz1-4/+6
system.h doesn't need it on its own and this change makes it less dependant on Rockbox internals. Change-Id: I4e1e4108a52a7b599627a829204eb82b392fc6d6
2012-06-10Fix checks on buflib allocated handles (0 is not a valid handle value)Bertrik Sikken1-1/+1
Change-Id: I8fdc5a59a5062f40a431cd49971390e21631b8ec
2012-05-02Use buflib for the allocation of voice PCM resources.Michael Sevakis1-1/+1
Buffers are not allocated and thread is not created until the first call where voice is required. Adds a different callback (sync_callback) to buflib so that other sorts of synchonization are possible, such as briefly locking-out the PCM callback for a buffer move. It's sort of a messy addition but it is needed so voice decoding won't have to be stopped when its buffer is moved. Change-Id: I4d4d8c35eed5dd15fb7ee7df9323af3d036e92b3
2011-12-20Another round of making local functions staticBertrik Sikken1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31384 a1c6a512-1295-4272-9138-f99709370657
2011-12-06Fix FS#12423 : Rockbox access to /.rockbox/fonts after usb_enable(true). ↵Boris Gjenero1-5/+0
This fixes entry into USB mode on the Archos Recorder V2 and possibly also other targets using a USB to IDE bridge chip. Fred Bauer found this removes the need for a workaround in glyph_cache_save(). I'm including his patch which removes the workaround. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31155 a1c6a512-1295-4272-9138-f99709370657
2011-11-27Guard font functions against invalid font ids. These arguably should never ↵Frank Gevaerts1-2/+4
be passed, but this prevents freezes. Fixes FS#12400 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31075 a1c6a512-1295-4272-9138-f99709370657
2011-11-27Actually make glyph_cache_save static instead of just claiming it should beFrank Gevaerts1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31074 a1c6a512-1295-4272-9138-f99709370657
2011-11-27glyph_cache_save should be staticFrank Gevaerts1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31073 a1c6a512-1295-4272-9138-f99709370657
2011-11-20Fix parameter order in font_load_in_memory(). FS#12395.Fred Bauer1-2/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31033 a1c6a512-1295-4272-9138-f99709370657
2011-11-19FS#12293 Global default glyph setting in System > Limits > Glyphs To Cache. ↵Fred Bauer1-253/+202
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-08Redo r30826 (and hopefully not reintroduce font issues) which cleans up the ↵Jonathan Gordon1-56/+19
font API. FONT_UI is deprecated, use screens[screen].getuifont() instead (and .setuifont() to set it after a font has been loaded) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30932 a1c6a512-1295-4272-9138-f99709370657
2011-11-03Make local functions and variables static where possibleBertrik Sikken1-2/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30897 a1c6a512-1295-4272-9138-f99709370657
2011-10-22Add functions font_set_ui() and font_get_ui(). The font returned by FONT_UI ↵Fred Bauer1-19/+56
used to be fixed at zero but since buflib-fonts (r30589) can be different, depending on the order of loads and unloads. Fixes broken behavoir in virtual keyboard (FS#12336), lyrics player (FS#12306), and hopefully, FS#12337 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30826 a1c6a512-1295-4272-9138-f99709370657
2011-10-21Add empty font_lock() for bootloaders to fix builds.Dominik Riebeling1-0/+6
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30817 a1c6a512-1295-4272-9138-f99709370657
2011-10-21Provide font_lock(). Font_get_bits() or ..width() may have to read glyph ↵Fred Bauer1-0/+10
cache misses from disk so provide a means to lock the buflib memory during the wait. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30814 a1c6a512-1295-4272-9138-f99709370657
2011-10-17Faster cached font loading. FS#12333Fred Bauer1-5/+35
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30769 a1c6a512-1295-4272-9138-f99709370657
2011-10-16FS:12299 Font glyph cache is no longer saved. Each font will now have its ↵Fred Bauer1-49/+106
own glyph cache file with the extension '.gc' Includes a temporary fix that delays saving the file to prevent the creation of multiple gc files with same name. Mostly JD Gordon's code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30760 a1c6a512-1295-4272-9138-f99709370657
2011-10-14Fix yellowFred Bauer1-5/+3
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30753 a1c6a512-1295-4272-9138-f99709370657
2011-10-14Remove font_reset() which tried to fetch font *pfs from uninitiaized ↵Fred Bauer1-21/+7
buflib_allocations. Change handle locking to track number of locks applied. Remove some duplicated code from internal_load_font() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30752 a1c6a512-1295-4272-9138-f99709370657
2011-10-14Don't make font available via buflib_allocations[] until fully loadedFred Bauer1-16/+18
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30750 a1c6a512-1295-4272-9138-f99709370657
2011-10-07Add two macros for char*-based pointer arithmetic and use it in font.cThomas Martitz1-16/+13
This fixes errornous pointer addition (+ on a short*), which crashed in some situation. Fixes FS#12317 and should hopefully get the clips booting again. Thanks to Jonathan Gordon for spotting the bad pointer arithmetic. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30724 a1c6a512-1295-4272-9138-f99709370657
2011-10-05Only alloc if necessary. Patch by Jonathan Gordon.Björn Stenberg1-4/+7
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30716 a1c6a512-1295-4272-9138-f99709370657
2011-09-29Don't leak file descriptor.Thomas Martitz1-0/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30619 a1c6a512-1295-4272-9138-f99709370657
2011-09-29font_load(): Reduce font memory allocation to the font's file size if less ↵Fred Bauer1-1/+8
than MAX_FONT_SIZE git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30618 a1c6a512-1295-4272-9138-f99709370657
2011-09-27Do not move NULL pointers in buflibmove_callback(). Fixes some skin crashes ↵Fred Bauer1-4/+8
when changing themes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30610 a1c6a512-1295-4272-9138-f99709370657
2011-09-26glyph_bytes() should pad to an even numberFred Bauer1-3/+6
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30606 a1c6a512-1295-4272-9138-f99709370657
2011-09-25Fix typos. Should have test compiled at least once :\Thomas Martitz1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30604 a1c6a512-1295-4272-9138-f99709370657
2011-09-25Fonts/buflib: The lru cache base poitner needs to be updated as well in the ↵Thomas Martitz1-0/+1
move callback. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30603 a1c6a512-1295-4272-9138-f99709370657
2011-09-24Allow fonts to use smaller buffers than the default size. use font_load_ex() ↵Jonathan Gordon1-9/+40
to speficiy the buffer size. If the font is already loaded with a smaller buffer it will be reloaded to use the new size. Also fix an issue where handles would get lost if fonts fail to load in skins git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30592 a1c6a512-1295-4272-9138-f99709370657
2011-09-24FS#12273 - use buflib for font storage. thanks to the testers :)Jonathan Gordon1-97/+189
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30589 a1c6a512-1295-4272-9138-f99709370657