Internal structure of ric fonts?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Internal structure of ric fonts?

Post by spillerrec »

As mentioned some time ago (2 months I guess) I'm working on a ric file viewer (and editing) application which is going to be used as an exam project. (Classes are very oriented towards GUIs, so I'm not just going to make a library anymore.)
I'm trying to get some EF features done and I'm implementing ric fonts now (as my TextOut()/NumOut() implementation will use FontTextOut() instead).

First of all, is there any documentations on ric fonts (that didn't disappear together with nxtasy)? I couldn't find any... As far as I know, to get a working ric font you need:
  • A sprite with ID 1 containing the graphics of the font.
  • A VarMap with ID 2 containing the x positions for the characters.
  • A VarMap with ID 3 containing the y positions for the characters.
  • A VarMap with ID 4 containing the width for the characters.
  • A VarMap with ID 5 containing the height for the characters.
  • A Options element with a value of 32769 and where width and height are the default width and height (for wrapping purposes).
However when I tried putting other elements into the file it didn't work quite as I had expected. I thought the file was called repeatably and each call drew one character. However it seems like it calls "GraphicOutEx()" once with parameter 0 containing the whole string, and when the Options element is reached it draws the whole string based on the VarMaps and Sprite available at that time.
Does anyone have a better understanding of what is going on in the firmware when calling FontTextOut()?


A bit off-topic, but I experienced funny results with RectOut() and negative widths and heights. Negative widths and heights are certainly not meaningful, but RectOut() takes int anyway. When using negative values, it seems to use abs() on the value thus ignoring the sign. I could understand if the rectangle didn't display or even if the rectangle now extended in the opposite direction but I didn't see this coming...
It is also interesting how CircleOut() is restricted to byte for radius, while ric files do not have this limitation.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests