Giter VIP home page Giter VIP logo

Comments (5)

PaintYourDragon avatar PaintYourDragon commented on June 29, 2024 1

I’ve not, yet. Been on other projects. Looking forward to using it on future stuff.

from adafruit_circuitpython_display_text.

kmatch98 avatar kmatch98 commented on June 29, 2024

Fully agreed that the baseline is a major consternation but was based on the (historical?) version of label. It uses the height of an ‘M’ to define the baseline using this code (line 199):

y_offset = int((self._font.get_glyph(ord("M")).height) / 2)

The baseline position is actually defined in the BDF font specification but is currently ignored in the current code.

On a related note, the ascender/descender height should be included in the BDF file but is not currently utilized. Instead, a few characters are checked to test the ascender/descender height. These dimensions is used for the background sizing along with tight_padding.

Any changes to the baseline should be propagated to label and bitmap_label for consistency.

One complexity with baseline positioning is that two ways are currently available to set the position, either (x,y) or by anchor_position.

If we can think of a way to consolidate this perhaps this would be more well-defined (but maybe more confusing?).

One proposal:

  1. Get rid of anchored_position and always use x,y to set the position (baseline or the anchor point).
  2. If anchor_point value is (None, None) then use the standard baseline values. If one of the anchor_point values is None then just use baseline for that axis. If both are set, the use x,y like anchored_position is currently used.

Also, the Open Book project @joeycastillo may have some guidance since that project formats a lot of text.

from adafruit_circuitpython_display_text.

kmatch98 avatar kmatch98 commented on June 29, 2024

New features for font ascent and descent were added in this recent PR: #110

from adafruit_circuitpython_display_text.

jposada202020 avatar jposada202020 commented on June 29, 2024

@PaintYourDragon have you test the new feature that we include in the library that allows different fonts to align to the baseline as you describe in this issue. Let us know if you have more ideas regarding this. Thanks.

from adafruit_circuitpython_display_text.

FoamyGuy avatar FoamyGuy commented on June 29, 2024

#115 and #134 have added this feature for x,y placement, and anchored_point.

It's much easier now to align different sized fonts as shown in the images above using thew new features. Closing this issue for now.

from adafruit_circuitpython_display_text.

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.