Comments (5)
I’ve not, yet. Been on other projects. Looking forward to using it on future stuff.
from adafruit_circuitpython_display_text.
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:
- Get rid of
anchored_position
and always use x,y to set the position (baseline or the anchor point). - If
anchor_point
value is(None, None)
then use the standard baseline values. If one of theanchor_point
values isNone
then just use baseline for that axis. If both are set, the use x,y likeanchored_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.
New features for font ascent
and descent
were added in this recent PR: #110
from adafruit_circuitpython_display_text.
@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.
#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)
- Try to remove max_glyphs restriction from label HOT 2
- When using background setter, background text does not show correctly HOT 2
- anchored position issue HOT 2
- Label init with max_glyphs instead of text value is broken
- Incorrect keyword parameters are ignored, and do not cause errors. HOT 1
- Width property not working in some cases HOT 4
- save_text=False throws error on init HOT 11
- Missing Type Annotations HOT 1
- Spaces are deleted when word-wrapping HOT 1
- Updates to text are inefficient for special case of same length and width text HOT 3
- bitmap_label losing direction HOT 6
- Suppress warnings in bitmap_label HOT 1
- Use `fontio.FontProtocol` for type annotations
- Label can take Tuple[int, int, int] for color HOT 1
- wrap_text_to_pixels() cannot handle Windows line endings HOT 1
- bitmap_label flicker HOT 1
- Unable to update scrolling_label text outside constructor HOT 2
- Exception with multiple consecutive newlines in bitmap label
- label.Label padding is wrong when using DWR or UPR HOT 5
- button simpletest throws error on PyPortal Titano HOT 1
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 adafruit_circuitpython_display_text.