Comments (3)
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.
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.
#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.
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)
- Feature request: text wrap HOT 1
- SdFat support? HOT 2
- Please support ARM cortex arch? HOT 2
- Feature Request: Text outline support
- Feature request: loading fonts from SPIFFS/LittleFS HOT 4
- Compilation error using "setBackgroundFillMethod" HOT 1
- How can an integer be printed without sprintf HOT 2
- Nucleo64 : undefined reference to `_open' HOT 6
- STM32H750 HOT 2
- Using SPIFFS instead of SD HOT 2
- Getting flickering with large front redraws HOT 6
- Text alignment seems shifted down about 50% of glyph height HOT 12
- ESP32 crash with certain configuration HOT 1
- Vertical centering with a line break HOT 4
- Recommendations for memory use? HOT 2
- Memory issue HOT 5
- OpenFontRender support for Teensy 4.1 HOT 16
- Recommendations for code changes HOT 2
- OpenFontRenderer memory requirements of loadFont() function HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openfontrender.