Announcement

Collapse
No announcement yet.

Loading Fonts

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

  • Loading Fonts

    I am using the uLCD-43PT for the UI on a Raspberry Pi system, using the serial command interface. For the 'at rest' display I am showing a digital clock using FONT3 and Text height/width with a multiplier of 6. The problem is that the system font looks very blocky at this size. Another, less significant, issue is that the colon, which I'm using as the time separator, is set to the right hand side of the character space, resulting in very uneven gaps.

    Is there any way of loading a better font (partial? - only digits and colon required), without having to find someone prepared to lend me their Windows box?

  • #2
    If you use a uSD font, you start running the 'risk' of Read Disturb if you are simply displaying time and updating it 'continuously'

    Why not only draw the colon once and reposition the text using gfx_MoveTo() to display each of the hours, minutes and seconds separately?
    Mark

    Comment


    • #3
      Thanks for the response. By 'continuously' are you suggesting that I have the RPi in a tight loop only writing to the display? I am writing the time once per second, but I am polling fairly continuously for touch_get - Get Status.

      At the moment I am running a single core Pi with four main threads running and other threads spawned as required. All communication with the display is handled by the same thread. I do intend to upgrade to a Pi2/3 at some time whereupon I propose to spread my four main threads between the four cores.

      If creating/loading fonts in my environment proves to be too difficult, I will have a play with filled polygons and/or raw images to define the characters. Where can I find details of the structure of the 'raw' images to be stored on the uSD card?

      Comment


      • #4
        I'm not exactly sure of the math, but I think, if you update the time every second, that you display the '0' over 23,000 times in a day. The guaranteed read time for the 'average' uSD is around 200,000 reads, so after 10 days an 'average' uSD card would be at risk of 'Read Disturb', easily enough solved with a card with read disturb protection, but something that needs considering when doing a clock.

        You only need Windows to create the uSD based font, and you can also do it under Parallels, or using Wine, so there should be no issue creating the font and then just copying it. What computer are you using that makes this seem difficult?

        The format of the images can be found here http://forum.4dsystems.com.au/forum/...isplay-modules

        Mark

        Comment


        • #5
          Originally posted by ESPsupport View Post
          The format of the images can be found here http://forum.4dsystems.com.au/forum/...isplay-modules
          Thanks for the pointer. I gather that post #4 is the one relating to raw mode. However, I'm a little bit confused about the third header word.
          Word3 = colour_mode : 16dec = 65K colour mode, 16bits/2bytes per pixel (msb, lsb)
          This seems to imply that the value of the third word should be decimal 16, with no other option. Yet, the last two lines of that post suggest that the permitted colour modes are zero and one.

          Also, I presume that he raw data is purely a stream of words (or bytes), rows from left to right, top to bottom, with the second row following the first row etc.

          In the meanwhile, I've tried drawing digits as filled polygons. This might be a feasible solution, but I seem to be unable to get the Move Origin command to work - the polygon is still drawn at top left. My code (simplified) snippet, in python:
          Code:
          port.write(b'\xff\xcc\x00\x96\x00\x96')
          print(port.read(1))
          
          port.write(b'\x00\x14\x00\x0a'+
               b'\x00\x06\x00\x16\x00\x26\x00\x26\x00\x36\x00\x36\x00\x06\x00\x06\x00\x16\x00\x16'+
               b'\x00\x0f\x00\x00\x00\x00\x00\x4b\x00\x4b\x00\x5a\x00\x5a\x00\x4b\x00\x4b\x00\x0f\xff\xff')
          print(port.read(1))
          Both commands return an ACK.

          Similarly, if I change the command to 'Draw Line & Move Origin', the line is correctly drawn, but the polygon is still drawn at top left.

          A Put String, following the Draw Polygon, also appears to remain placed relative to the top left and not relative to a new origin.

          What am I missing?

          Comment


          • #6
            16 is the only currently valid option, 0 was from the 'olden days' when people still used 8 bit colour.

            Yes, top left to bottom right, the way you described

            The origin is only for graphical commands that have an implied/unstated origin. Almost none of these have been made available in the serial command set (off the top of my head orbit is the only serial command that needs to / uses origin 'properly').
            Mark

            Comment


            • #7
              Originally posted by ESPsupport View Post
              The origin is only for graphical commands that have an implied/unstated origin. Almost none of these have been made available in the serial command set (off the top of my head orbit is the only serial command that needs to / uses origin 'properly').
              Well, I have to say that that is very unclear from reading the Serial Environment doc, which states:
              The Move Origin command moves the origin to a new position, which is suitable for specifying the location for both graphics and text.
              Perhaps you can clarify another point - The 'Set Graphics Parameters' page implies that the uLCD-43 range has more than one display page (Page Display, Page Read and Page Write functions). Since the 'Screen Resolution' function does not apply to the uLCD-43, this would imply that multiple pages are available at the full native resolution. Is this true and, if so, how many pages are available?

              Would it be possible to write the polygons to one (hidden) page, then use the 'Screen Copy Paste' command to place the required images on the displayed page?
              Last edited by PeterBell; 4 July 2016, 12:40 AM.

              Comment


              • #8
                There are 3 and a bit pages.

                You could use screencopypaste, but I think you will find it slower than doing a new polygon, as screencopypaste is not a fast command.
                Mark

                Comment

                Working...
                X