Announcement

Collapse
No announcement yet.

Fonts

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fonts

    hello,

    I'm trying to upload a new font to my uLCD-32032-P1T.

    I tried this:

    1. Used "Font Tool" to export an Arial font to a 4DGL font file.
    2. Uploaded the Picaso SGC PmmC to the module.
    3. With the "DISP" tool, first loaded the right header file for my module. Then imported the font and rearranged the fonts so my font is at 4th position. Then successfully loaded the new configuration to the module.
    4. To start my app, I re-uploaded the 4DGL PmmC file. I then added the line "txt_Set(FONT_SIZE, FONT4) to my code (assuming this would select font 4).

    This doesn't work at all. I still see the old standard font. What am I doing wrong?

    thanks,
    alex

  • #2


    Hi Alex,
    You are mixing SGC with the 4DGL PmmC file. Both are individually distinct configurations. DISP tool is a software tool for SGC configuration, you cannot use it with 4DGL PmmC file.
    At the moment there is no such feature to add external fonts on the PICASO based platforms under 4DGL.
    With SGC PmmC loaded the module would be called uLCD-32032-P1T(SGC). You can add external fonts on PICASO under SGC configuration. You can do step 1, 2 and 3 as you mentioned to do that. Later you would need to send appropriate serial commands from the host controller to invoke the relevant functions.
    -Bilal

    Comment


    • #3


      Thanks!
      Alright, then I can stop trying. But then, what's the point of that 4DGL font file when I can't even use that font within 4DGL?

      Alex

      Comment


      • #4
        For what it's worth, you can always export each individual letter, and use it with the gfx_Bitmap function.

        This would also enable you to have a lookup table of 'actual' font widths, (and perhaps font y-offsets)

        i.e.
        Code:
        word fArialLookup
            arialSpace, 0, 0, 0, 0, arialPercentage, 0, 0, 0, 0, 0, 0, 0, arialDash, arialDot, arialSlash,
            arial0, arial1, arial2, arial3, arial4, arial5, arial6, arial7, arial8, arial9,
            0, 0, 0, 0, 0, 0, 0, // : ; < = > ? @
            arialA, arialB, arialC, arialD, arialE, arialF, 0, arialH, arialI, 0, 0, arialL, 0, arialN, arialO, 0, 0, arialR, arialS, 0, arialU, 0, 0, 0, 0, 0, // A-Z
            0, 0, 0, 0, 0, 0, // [ \ ] ^ _ `
            0, arial_b, 0, 0, 0, 0, arial_g, 0, 0, 0, 0, arial_l, arial_m, 0, 0, arial_p, 0, arial_r, 0, 0, 0, 0, 0, 0, 0, 0 // a-z
            
        
        byte fArialLookupW
             6,  0,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  8,  4,  8, // spc ! " # $ % & ' ( ) * + , - . /
            15, 10, 15, 15, 16, 16, 15, 15, 15, 15, // 0-9
             0,  0,  0,  0,  0,  0,  0, // : ; < = > ? @
            23, 21, 22, 21, 19, 17,  0, 22,  7,  0,  0,  17,  0, 22, 24,  0,  0, 22, 21,  0, 22,  0,  0,  0,  0,  0, // A-Z
             0,  0,  0,  0,  0,  0, // [ \ ] ^ _ `
             0, 16,  0,  0,  0,  0, 16,  0,  0,  0,  0,  5, 24,  0,  0, 16,  0, 9,  0,  0,  0,  0,  0,  0,  0,  0  // a-z
        
        byte fArialLookupO
             0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14, 20,  1, // spc ! " # $ % & ' ( ) * + , - . /
             1,  1,  1,  1,  1,  1,  1,  1,  1,  1, // 0-9
             0,  0,  0,  0,  0,  0,  0, // : ; < = > ? @
             1,  1,  1,  1,  1,  1,  0,  1,  1,  0,  0,  1,  0,  1,  1,  0,  0,  1,  1,  0,  1,  0,  0,  0,  0,  0, // A-Z
             0,  0,  0,  0,  0,  0, // [ \ ] ^ _ `
             0,  1,  0,  0,  0,  0,  7,  0,  0,  0,  0,  1,  7,  0,  0,  7,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0  // a-z
        
        
        func DisplayArialLetter(var x, var y, var colour, var opaque, var char)
            var h, w, o;
        
            if (char >= 0x20 && char <= 0x7A)
                char := char - 0x20;
        
                w := fArialLookupW[char];
        
                if (w > 0)
                    if (opaque == OPAQUE)
                        gfx_Rectangle(x, y, x + w + 2, y + 30 - 1, get_BackgroundColour());
                    endif
        
                    gfx_Bitmap(fArialLookup[char], x, y + fArialLookupO[char], colour);
                endif
            else if (char == 0xB3) // cubed symbol
                w := 9;
        
                if (opaque == OPAQUE)
                    h := fArialLookup[char][1];
                    gfx_Rectangle(x, y, x + w + 2, y + 30 - 1, get_BackgroundColour());
                endif
        
                gfx_Bitmap(arial_cubed, x, y, colour);
            endif
            
            return w + 3;
        endfunc
        
        func DisplayArial(var x, var y, var colour, var opaque, var msg)
            var ch;
            
            repeat
                ch := *msg;
                if (ch == 0) break;
                
                x := x + DisplayArialLetter(x, y, colour, opaque, ch);
                *msg++;
            forever
            
            return x;
        endfunc
        It might not be as fast as using an internal font, but It's more than fast enough for what I need (I haven't done any speed tests with it), a full page of text appears without me noticing it drawing.

        Comment


        • #5


          thanks, I might try that. Most of my text is fixed, too...so speed shouldn't be critical.

          Comment

          Working...
          X