Code Monkey home page Code Monkey logo

Comments (3)

takkaO avatar takkaO commented on June 18, 2024 2

Thank you for using.

I will try your code. Please give me some time.

(I crezy busy my main business, so it will takes time 🙇‍♂️🙇‍♂️🙇‍♂️)

from openfontrender.

chconnor avatar chconnor commented on June 18, 2024

Thanks @takkaO -- in case it's helpful, below is some demo code.

And here is the reduced URWGothic-Book.h.

Attached is a pic of the output. You can see that the left side of the Align::TopRight section is not even. However the right side of Align::TopLeft section is even. So it would seem that there is a difference when the align is left or right in terms of how it computes the edge of the character.

Attached is also a pic of the "1" and "2" digits in fontforge, in case that's useful.

ofr_render_issue

ofr_issue_chars_ff

#include <Arduino.h>
#include "SPI.h"
#include <TFT_eSPI.h> // screen; uses src/TFT_eSPI_Setup.h after library file User_Setup_Select.h changed to #include <../../../../src/TFT_eSPI_Setup.h> 
#include "OpenFontRender.h"
#include "URWGothic_Book.h"

#define TFT_BLK 4 // pin for enable/disable of screen backlight
static TFT_eSPI tft = TFT_eSPI();
static OpenFontRender ofr;

void setup()
{
  Serial.begin(115200);
  while (!Serial) delay(10);

  pinMode(TFT_BLK, OUTPUT);
  digitalWrite(TFT_BLK, HIGH); // HIGH=screen on
  tft.init();
  tft.fillScreen(TFT_BLACK);

  ofr.setDrawer(tft); // Link drawing object to tft instance (so font will be rendered on TFT)
  ofr.setFontColor(TFT_WHITE, TFT_BLACK); // bg color is for antialiasing
  if (ofr.loadFont(URWGothic_Book, sizeof(URWGothic_Book)))
  {
     Serial.println("font initialization error");
     return;
  }

  ofr.setFontSize(15);

  ofr.setAlignment(Align::TopRight);
  ofr.setCursor(20, 20);
  ofr.printf("90");
  ofr.setCursor(20, 40);
  ofr.printf("91");             // *********** why does this one shift to the right?
  ofr.setCursor(20, 60);
  ofr.printf("92");

  ofr.setAlignment(Align::TopLeft);
  ofr.setCursor(20, 90);
  ofr.printf("09");
  ofr.setCursor(20, 110);
  ofr.printf("19");            // *********** this one looks OK, as expected
  ofr.setCursor(20, 130);
  ofr.printf("22");
}

void loop() { ; }

from openfontrender.

larrybud2004 avatar larrybud2004 commented on June 18, 2024

Also experiencing this with the stock NotoSans_Bold font. Font size doesn't matter, although it's more difficult to see at small sizes.

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.