2011/2/20 mattschinkel <[email protected]> > A procedure could not > be used in this case due to constants. >
Yes, it's not possible, not this way. (and btw, your implementation of lcd_write_char() in glcd_stm032qvt-003.jal takes a font table as first parameter (byte in), I think there's an overhead (probably huge) here if the compiler doesn't pass this by reference. Which it doesn't IIRC) But... instead of registering "font_1 is font_6x8" etc... you can just define font ID, and say: glcd_font_use(FONT_5x7) this is what I've done, client code looks like this: -- sample.jal [...] const byte FONT_AUTO_WRAP = TRUE -- auto wrap text at end of screen include glcd_5x7_font include glcd_6x8_font include glcd_common include glcd_nokia3310 glcd_init() include glcd_common glcd_font_use(FONT_5x7_ID) lcd = "A" glcd_font_use(FONT_6x8_ID) lcd = "1" Regarding font libraries, the rules are: - each font lib (eg. glcd_font_5x7.jal) defines its own ID: const byte FONT_5x7_ID = 0x01 - this means amongst font libs, there's no collision - in glcd_font.jal, some variables are used to store current font parameters (width, height, id) - glcd_font_use(byte in font_id) adjusts these current parameter. Implementation is based on "if defined(FONT_5x7_ID) && font_id == FONT_5x7_ID then ...". One "if" block per font libraries. - font ID 0x00 is reserved (might be useful when defaulting is needed, ie. current font is invisible). - jallib font ID steps forward (0x01, 0x02, ...) - use defined font starts from 0xFF (or 0xFE, 0xFF could be resersed too for special purpose), and steps backward (0xFE, 0xFD, ...) - this means we can have up to 253 fonts... In real life, we would implement 2 or 3 user defined ID, and adjust as needed - still in glcd_font.jal, glcd_font_lookup(byte in idx) returns the corresponding cell in current font lookup table (and there's no table passed as argument). Not sure yet if this is the proper way to use this procedure, I mean, API might be improved Current implementation I have is based on many "if defined()". I need to check, but overhead might not be important when using only one font. Regarding this, I've found ks1008 glcd lib defines its own lookup table, so is stm003 (can't remember the name). We could two ways to deal with font: 1. built-in: each glcd lib (ks1008, stm3, nokia_3310) defines a default lookup table, and some glcd specific procedures, actually using this table (some prefix is glcd name, eg. nokia_3310_*). No overhead, less flexible. 2. specific API using generic fonts, where some procedures needs to exist (lcd_write_char() for instance) User has the choice. Cheers, Seb > Matt. > > On Feb 20, 7:51 am, Sebastien Lelong <[email protected]> > wrote: > > Indeed, we really, really shouldn't assume printing chars between 32 to > 126. > > A user, like me, could define its own font, actually representing a > > temperature gauge, for instance. > > > > cheers, > > seb > > > > 2011/2/20 Oliver Seitz <[email protected]> > > > > > > > > > > > > > > What if you want to add some specific chars ? > > > > > Das hätte ich noch angesprochen (I had mentioned that), but I was sure > that > > > you, Sébastien, would see this, too ;-) > > > > > Greets, > > > Kiste > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "jallib" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group at > > >http://groups.google.com/group/jallib?hl=en. > > > > -- > > Sébastien Lelonghttp://www.sirloon.nethttp://sirbot.org > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/jallib?hl=en. > > -- Sébastien Lelong http://www.sirloon.net http://sirbot.org -- You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jallib?hl=en.
