- Status Closed
- Percent Complete
- Task Type Patches
- Category Plugins
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version Version 3.2
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
FS#10099 - lib, which display formatted text on every target
The text is displayed on the full screen size and can also be formatted. The lib should work on every target.
The code is based on the function do_help() from Will Robertson.
Please help me to improve the lib.
Closed by teru
2009-07-14 13:36
Reason for closing: Accepted
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
2009-07-14 13:36
Reason for closing: Accepted
Additional comments about closing: Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407
Committed in r21861.
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
The patch aroses from the problem, that if you use rb→lcd_putsxy(x, y, “text”) the text doesn’t always fits on the screen, because every target has an different screen size.
Some other plugins(e.g. star) uses a function called display_text(), which displays the text in a right way on the screen, but the function doesn’t support styles, so the text is hard to read and looks a little bit boring.
The lib give you the ability to display formatted text in a nice way.
The main disadvantage of the lib is that it uses a lot of memory, but I can’t think of an other solution to combine style and adaptation to the screen size.
The remaining text will be displayed, if you press any button.
can we include different fonts on the same page?
like bold, italics or actual different fonts?
we can scale the x and y in if you use rb→lcd_putsxy(x, y, “text”) ….
we can get the actual screen size of the player and convert it to the specific screen size using a simple % calculation.
@hittudiv It’s not available to include different fonts easily in display_font(), because a bigger font needs another line distance, so the whole line have to be displayed again. It would be great to display bold and italics, but unfornunately most fonts doesn’t support it.
I have included the lib in brickmania, but I have to work on the viewport integration. The problem is, that I need the x, y, width and height from the viewport struct, but I don’t know how to get it from the current viewport.
brickmania example usage of the lib
The lib supports now also viewport, but it’s important, that you pass the viewport to the funtion. I hope the lib is useful and doesn’t use to much memory.
Please test the lib and if necessary rename it.
brickmania_display_text.diff (8.1 KiB)
tiny fix
set drawmode to solid
your patch seems to do some strange things for me.
Declaration of standard_fcolor also shoud be surrounded by “#if LCD_DEPTH > 1”.
“standard_fcolor=(*vp_text).fg_pattern;” at line 53 is duplicated.
In my opinion, it is not necessary to restore drawmode.
Is there any reason not waiting key input aftrer displaying last word?
It would be nice if you implement scrolling up/down the text.
sorry for my bad english and description.
Thank you for your bugreports and help.
I fixed the bugs you have detected and avoid unused parameter warnings on targets without color or bitmaps.
brickmania_display_text.diff (7.7 KiB)
Upps, silly bug in brickmania_display_text.diff
Fixed a bug, which occurs on Archos Player/Studio, because of its small display size.
*cleanup a bit.
*rename text.* to display_text.* to fit name of function.
*modify some plugins to use display_text.
use_lib_display_text.patch (57.2 KiB)
I committed the lib display_text; thanks Teruaki Kawashima. Actually I don’t like bitwise operation, but it’s a nice solution.
The patch, which modify the plugins to use display_text needs a review. I will do this within the next few days.
Why do you use struct style_text (and pass a struct pointer as argument for display_text) when you can simply pass an unsigned short? (I would prefer an (unsigned) int though)
*fix crash in brickmania
repeating entering and quiting help in brickmania crash the player.
*make “formation” static.
*try to reduce size of “formation”.
As far I just look at the lib; the idea to make a struct, which consist of index and the formation is great.
But it could be a nerve limiatation, that the last text item musn’t be a formatted word. Of course you could use just “” but it isn’t elegant and can lead to problems!
I fix some minor typos and remove the limitation that the last item must be a unformatted word.