Coder Social home page Coder Social logo

Comments (6)

takkaO avatar takkaO commented on June 1, 2024

Thank you for using this library 😊

Unfortunately, I have never used the sprite feature.
Please tell me the smallest code that can reproduce the issue in my environment.
And what microcontroller you are using.

Thank you.

from openfontrender.

MikeyMoMo avatar MikeyMoMo commented on June 1, 2024

Note: The full demo program for OpenFontRender library I wrote is here: https://github.com/MikeyMoMo/OpenFontRender-Example-program

I have noticed the same thing. Just throw something on screen with foreground and background colors set. The background color is ignored. If you want it, that is a very good thing -- an invisible background color not changing the background of the characters. However, if you want the background color to happen, it is not good the way it is. I am writing to two different sprites and to the base tft screen.

Here is a code snippet I wrote to check out every non-trivial call in your API listing. I posted elsewhere with other errors that came up while writing and testing this program such as text height is wrong and the bounding box is wrong.

Here, the background color setting (done 2 ways) is ignored anyway. The letters come out white on black, not red.

  tft.fillScreen(TFT_BLACK);
  // Alignment Left
  // If the second font color is missing, it will be written invisible and the background color
  //  already on the screen will not be changed.  To change it, use a second color like this:
  render.setFontColor(TFT_WHITE, TFT_RED);  // Foreground, Background (optional)
  // Note, it can also be set by 8 bit hex values.  Foreground only or foreground and background, as above.
  //  render.setFontColor(0x50, 0x70, 0x150); // Mostly blue, a little green and less red. FG only set.
  //  ...or...
  //  render.setFontColor(0x50, 0x70, 0x150, 0x150, 0x70, 0x50);  // Set FG and BG to custom colors.
  //
  // You can also set the background color, only, thus:
  render.setBackgroundColor(TFT_RED);  // Change BG color only, leave font color as already set.
 
  // So far, the background color setting does nothing.  Maybe this is by design.

  // Alignment left
  render.setCursor(0, 0);
  render.printf("Hello\nWorld size ");  // Only foreground color honored.

from openfontrender.

beng2k avatar beng2k commented on June 1, 2024

As above. Sorry for the delay.
I can pull some code but this above looks very similar to what I have done as well.

As above it seems as though the background colour is ignored

from openfontrender.

MikeyMoMo avatar MikeyMoMo commented on June 1, 2024

I just uploaded my full demo code that shows this (not) happening. It also shows how to use all but the most trivial calls to this library and even shows some of the trivial ones. It is my first Github repository. Please be kind... ;-))
It is here:

https://github.com/MikeyMoMo/OpenFontRender-Demo-program

There is a notation that the font BG color is not being used. I am not sure if that is in a sprite but it fails. I could do it to a sprite if necessary. I use OFR for both sprites and background (tft) screen writes and it operates the same both ways. Also under MikeyMoMo is a very full featured clock/calendar program that uses OFR for almost everything, sprites and tft writes. All works pretty well. Just a few little bugs to work out. SO glad to have this library!!!

from openfontrender.

takkaO avatar takkaO commented on June 1, 2024

From v1.1, you can select background fill method.
Try using the setBackgroundFillMethod() function.
See GitHub Pages for details.

I am really sorry for the late updateπŸ™‡β€β™‚οΈπŸ™‡β€β™‚οΈπŸ™‡β€β™‚οΈ

from openfontrender.

MikeyMoMo avatar MikeyMoMo commented on June 1, 2024

This works. The lines I used are:

      scrollSprite.fillRect(trackTimeDate, 0, scrollSpriteW, scrollSpriteH, DarkBlue);
      ofr.setDrawer(scrollSprite);
      ofr.setFontColor(TFT_WHITE, DarkBlue);
      ofr.setBackgroundFillMethod(BgFillMethod::Block);

from openfontrender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.