This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR5969: Flipping font file

Other Parts Discussed in Thread: BOOSTXL-SHARP128, MSP430FR5969

Hi Team,

I'm using an MSP430FR5969 with a BOOSTXL-SHARP128 LCD display.  Because of a legacy program, we use the display upside down - that is, the "top" of the display is the edge with the ribbon cable.  If I use the standard font file "fontfixed6x8.c", the characters are displayed upside down (naturally) as we look at the display.  In an attempt to display the characters "right side up" for our orientation, I've created a file "fontfixed6x8Reversed.c", which I have attached.  

Within my code I create the Context:

    tContext g_sContext;

    GrContextInit(&g_sContext, &g_sharp128x128LCD);
    GrContextForegroundSet(&g_sContext, ClrBlack);
    GrContextBackgroundSet(&g_sContext, ClrWhite);
//    GrContextFontSet(&g_sContext, &g_sFontFixed6x8);
    GrContextFontSet(&g_sContext, &g_sFontFixed6x8Reversed);
    GrClearDisplay(&g_sContext);
    GrFlush(&g_sContext);

I also added this line to grlib.h:

extern const Graphics_Font g_sFontFixed6x8Reversed;

 

I then use GrStringDraw to put a string sHR onto the display:

        GrStringDraw(&g_sContext,               
                     (int8_t *)sHR,
                     AUTO_STRING_LENGTH,
                     10,
                     118,
                     OPAQUE_TEXT);

 

If I comment out the g_sFontFixed6x8Reversed line and use the g_sFontFixed6x8 line, my text string displays as expected.  It's upside down and in the upper right corner of the display as seen from our orientation.

However, if I comment out the g_sFontFixed6x8 line and use the g_sFontFixed6x8Reversed line instead (changing nothing else in the program), it doesn't display anything.

I've tried to use the debugger to step through GrStringDraw but whichever font I use, the characters are seen as "absent" when in the debugger and nothing is displayed.  If I run without stepping into GrStringDraw, the original font displays but the Reversed one does not.

I'm hoping someone can look at the attached file and tell me if they see something that I did incorrectly when building the font file.  

Thanks in advance!

Kind Regards,

Jejomar

  • Hi Jejomar,

    I think "right side up" method need to check, but I don't have this  BOOSTXL-SHARP128.

    Maybe you need debug those example code to find someting. I can try to apply this BOOSTXL to do some test, but need some times.

    Thanks!

    Best Regards

    Johnson

  • Hi Johnson,

    My apologies. I haven't attached the font file in subject to this query.

    Can we ask for your assistance in taking a look and review at the file I attached to the fontfixed6x8Reversed.c font file that I attached to this post? My first inclination is that I did something incorrectly in setting up that file.

    Thanks for your help!


    Kind Regards,

    Jejomar




    /*
     * fontfixed6x8Reversed.c
     *
     *  Created on: Nov 8, 2022
     *      Author: joefr
     */
    
    
    #include "grlib.h"
    
    //*****************************************************************************
    //
    // Details of this font:
    //     Style: fixed
    //     Size: 8 point
    //     Bold: no
    //     Italic: no
    //     Memory usage: 960 bytes
    //
    //*****************************************************************************
    
    //*****************************************************************************
    //
    // The uncompressed data for the fixed-point 6x8 font.
    //
    //*****************************************************************************
    static const uint8_t g_pucFontFixed6x8DataReversed[760] =
    {
     0,   0,   0,   0,   0,   0,  96,  16,
     0,  64,   0,  16,  65,   4,  96,  16,
     0,   0,   0,   0, 162, 138,  96,  16,
     0, 162, 159,  41, 242, 138,  96,  16,
     0,  67, 212,  56,  87, 132,  96,  16,
     1, 134,  66,  16, 132, 195,  96,  16,
     1,  98,  85,   8,  82,  70,  96,  16,
     0,   0,   0,   0,  33,   6,  96,  16,
     0, 129,   2,   8,  33,   8,  96,  16,
     0,  33,   8,  32, 129,   2,  96,  16,
     0,   1,  21,  57,  81,   0,  96,  16,
     0,   1,   4, 124,  65,   0,  96,  16,
     0,  33,   6,   0,   0,   0,  96,  16,
     0,   0,   0, 124,   0,   0,  96,  16,
     0,  97, 128,   0,   0,   0,  96,  16,
     0,   0,  66,  16, 132,   0,  96,  16,
     0, 228,  83,  85, 148,  78,  96,  16,
     0, 225,   4,  16,  65, 132,  96,  16,
     1, 240, 132,  33,   4,  78,  96,  16,
     0, 228,  80,  32,  66,  31,  96,  16,
     0, 130,  31,  36, 163,   8,  96,  16,
     0, 228,  80,  64, 240,  95,  96,  16,
     0, 228,  81,  60,  16, 140,  96,  16,
     0,  32, 130,  16, 132,  31,  96,  16,
     0, 228,  81,  57,  20,  78,  96,  16,
     0,  98,  16, 121,  20,  78,  96,  16,
     0,   1, 134,   0,  97, 128,  96,  16,
     0,  33,   6,   0,  97, 128,  96,  16,
     0, 129,   2,   4,  33,   8,  96,  16,
     0,   0,  31,   1, 240,   0,  96,  16,
     0,  33,   8,  64, 129,   2,  96,  16,
     0,  64,   4,  33,   4,  78,  96,  16,
     0, 229,  85,  89,   4,  78,  96,  16,
     1,  20,  95,  69,  20,  78,  96,  16,
     0, 244,  81,  61,  20,  79,  96,  16,
     0, 228,  65,   4,  20,  78,  96,  16,
     0, 114,  81,  69,  18,  71,  96,  16,
     1, 240,  65,  60,  16,  95,  96,  16,
     0,  16,  65,  60,  16,  95,  96,  16,
     1, 228,  81, 116,  20,  78,  96,  16,
     1,  20,  81, 125,  20,  81,  96,  16,
     0, 225,   4,  16,  65,  14,  96,  16,
     0,  98,  72,  32, 130,  28,  96,  16,
     1,  18,  69,  12,  82,  81,  96,  16,
     1, 240,  65,   4,  16,  65,  96,  16,
     1,  20,  81,  85,  86, 209,  96,  16,
     1,  20,  89,  85,  52,  81,  96,  16,
     0, 228,  81,  69,  20,  78,  96,  16,
     0,  16,  65,  61,  20,  79,  96,  16,
     1,  98,  85,  69,  20,  78,  96,  16,
     1,  18,  69,  61,  20,  79,  96,  16,
     0, 244,  16,  56,  16,  94,  96,  16,
     0,  65,   4,  16,  65,  31,  96,  16,
     0, 228,  81,  69,  20,  81,  96,  16,
     0,  66, 145,  69,  20,  81,  96,  16,
     0, 165,  85,  85,  20,  81,  96,  16,
     1,  20,  74,  16, 164,  81,  96,  16,
     0,  65,   4,  41,  20,  81,  96,  16,
     1, 240,  66,  16, 132,  31,  96,  16,
     0, 224, 130,   8,  32, 142,  96,  16,
     0,   4,   8,  16,  32,  64,  96,  16,
     0, 226,   8,  32, 130,  14,  96,  16,
     0,   0,   0,   1,  18, 132,  96,  16,
     1, 240,   0,   0,   0,   0,  96,  16,
     0,   0,   0,   0, 129,   2,  96,  16,
     1, 228,  94,  64, 224,   0,  96,  16,
     0, 244,  81,  76, 208,  65,  96,  16,
     0, 228,  65,   4, 224,   0,  96,  16,
     1, 228,  81, 101, 100,  16,  96,  16,
     0, 224,  95,  68, 224,   0,  96,  16,
     0,  32, 130,  28,  36, 140,  96,  16,
     0, 228,  30,  69,  23, 128,  96,  16,
     1,  20,  81,  76, 208,  65,  96,  16,
     0, 225,   4,  16,  96,   4,  96,  16,
     0,  98,  72,  32, 192,   8,  96,  16,
     0, 145,  67,  20, 144,  65,  96,  16,
     0, 225,   4,  16,  65,   6,  96,  16,
     1,  20,  85,  84, 176,   0,  96,  16,
     1,  20,  81,  76, 208,   0,  96,  16,
     0, 228,  81,  68, 224,   0,  96,  16,
     0,  16,  79,  68, 240,   0,  96,  16,
     1,   4,  30, 101,  96,   0,  96,  16,
     0,  16,  65,  76, 208,   0,  96,  16,
     0, 244,  14,   4, 224,   0,  96,  16,
     0, 196, 130,   8, 112, 130,  96,  16,
     1, 102,  81,  69,  16,   0,  96,  16,
     0,  66, 145,  69,  16,   0,  96,  16,
     0, 165,  85,  69,  16,   0,  96,  16,
     1,  18, 132,  41,  16,   0,  96,  16,
     0, 228,  30,  69,  16,   0,  96,  16,
     1, 240, 132,  33, 240,   0,  96,  16,
     0, 129,   4,   8,  65,   8,  96,  16,
     0,  65,   4,  16,  65,   4,  96,  16,
     0,  33,   4,  32,  65,   2,  96,  16,
     0,   0,   0,   0, 133,  66,  96,  16,
    
    };
    
    //*****************************************************************************
    //
    // The font definition for the fixed-point 6x8 font.
    //
    //*****************************************************************************
    const Graphics_Font g_sFontFixed6x8Reversed =
    {
        //
        // The format of the font.
        //
        GRAPHICS_FONT_FMT_UNCOMPRESSED,
    
        //
        // The maximum width of the font.
        //
        6,
    
        //
        // The height of the font.
        //
        8,
    
        //
        // The baseline of the font.
        //
        7,
    
        //
        // The offset to each character in the font.
        //
        {
               0,    8,   16,   24,   32,   40,   48,   56,
              64,   72,   80,   88,   96,  104,  112,  120,
             128,  136,  144,  152,  160,  168,  176,  184,
             192,  200,  208,  216,  224,  232,  240,  248,
             256,  264,  272,  280,  288,  296,  304,  312,
             320,  328,  336,  344,  352,  360,  368,  376,
             384,  392,  400,  408,  416,  424,  432,  440,
             448,  456,  464,  472,  480,  488,  496,  504,
             512,  520,  528,  536,  544,  552,  560,  568,
             576,  584,  592,  600,  608,  616,  624,  632,
             640,  648,  656,  664,  672,  680,  688,  696,
             704,  712,  720,  728,  736,  744,  752,
        },
    
        //
        // A pointer to the actual font data
        //
        g_pucFontFixed6x8DataReversed
    };
    
    
    

  • Hi Jejomar,

    I am not familar with this example, thus I have to do some test and run some code to learn this example first.....

    Then I can give your comments about your code.

    Thanks!

    Best Regards

    Johnson

  • Hi Jejomar,

    I don't get SHARP128, but I have a SHARP96.

    I had a look for this example code, look those table generated by some softwaret, I think this is difficult to change those to match display upside down.

    Thanks!

    Best Regards

    Johnson

  • Hi Johnson,

    Our customer did a lot more digging and came across another post on E2E about using the ftrasterize tool of TI's to generate fonts from ttf files. They then searched on upside down fonts and found one that works! They downloaded the .ttf file for that fount, ran it through ftrasterize, and loaded it up on the program. And now, everything works great!

    Your assistance certainly helped our customer to look into the right direction. Many thanks for your help! We can now close this thread.


    Kind Regards,

    Jejomar

  • Hi Jejomar,

    Thanks, I will close this thread.

    Thanks!

    Best Regards

    Johnson

**Attention** This is a public forum