含义顶部,上升,基准线,血统,底部,并引领Android的的FontMetrics [英] Meaning of top, ascent, baseline, descent, bottom, and leading in Android's FontMetrics
问题描述
这似乎是一个基本的问题,但我无法找到一个类似的SO。在阅读<一个href="http://developer.android.com/reference/android/graphics/Paint.FontMetrics.html">documentation,我遇到了麻烦把握的概念。我想了解不同的是顶
和上升
也底$之间有什么C $ C>和
血统
。而到底是哪里的底线?你有一个图来帮助我想象呢?
This seems like a basic question, but I couldn't find a similar one on SO. While reading the documentation, I was having trouble grasping the concepts. I want to understand what the difference is between top
and ascent
and also bottom
and descent
. And where exactly is the baseline? Do you have a diagram to help me visualize it?
推荐答案
让我们先来回顾一下文件说:
- 热门 - 上面的基线在给定的文本大小最高的字形字体中的最大距离。
- 的Ascent - 上面的基线单挑间隔文本建议的距离。
- 的后裔 - 基线单挑间隔文字下面推荐的距离。
- 底 - 在给定的文本大小的基准字体中的最低字形下面的最大距离。
- 领导 - 推荐的额外空间文本行之间添加。
- Top - The maximum distance above the baseline for the tallest glyph in the font at a given text size.
- Ascent - The recommended distance above the baseline for singled spaced text.
- Descent - The recommended distance below the baseline for singled spaced text.
- Bottom - The maximum distance below the baseline for the lowest glyph in the font at a given text size.
- Leading - The recommended additional space to add between lines of text.
请注意,在基线是前四个是从测量的。这是行形成的基础的文本坐,即使某些字符(如G,Y,J等),可能有部分的走线下。这相当于把你带衬的笔记本上写上线。
Note that the Baseline is what the first four are measured from. It is line which forms the base that the text sits on, even though some characters (like g, y, j, etc.) might have parts that go below the line. It is comparable to the lines you write on in a lined notebook.
下面是一张图片,以帮助可视化这些东西:
Here is a picture to help visualize these things:
记住,在Java和Android的画布上绘制的时候,下去是的增加的Y和上升是一个的降低的y中。这意味着,的FontMetrics顶
和上升
是负数,因为他们是从基线测量的(虽然血统和底部正数)。因此,为了得到顶
的距离底
,你需要做的(底
- 顶
)
Remember that when drawing on a canvas in Java and Android, going down is an increase in y and going up is a decrease in y. That means that FontMetrics' top
and ascent
are negative numbers since they are measured from the baseline (while descent and bottom are positive numbers). Thus, to get the distance from top
to bottom
you would need to do (bottom
- top
).
在领先强>是一条线的底部和下一行的顶部之间的距离。在图片是1号线的橙色和紫色2号线的根据<一之间的空间href="http://evendanan.net/2011/12/Font-Metrics-in-Java-OR-How-the-hell-Should-I-Position-This-Font/">this网站,不过,主要
通常被设置为零。下降底部和上升顶部的距离通常提供足够的行间距了。
The leading is the distance between the bottom of one line and the top of the next line. In the picture it is the space between the orange of Line 1 and the purple of Line 2. According to this site, though, leading
is usually set to zero. The descent-bottom and the ascent-top distances usually provide enough line spacing already.
请查看以下链接了解更多信息:
Check out these links for more information:
- precise Android的文本绘制
- <一个href="http://evendanan.net/2011/12/Font-Metrics-in-Java-OR-How-the-hell-Should-I-Position-This-Font/">Font在Java中(和Android) 指标
- 布局文档
- 的Java?的FontMetrics上升不正确
- <一个href="http://stackoverflow.com/questions/5259015/fontmetrics-not-correct-when-run-on-android-device-simulator-fine">FontMetrics不正确的Android设备上运行时。模拟器精
- Java的字体指标(Java的似乎不使用
顶
和底
)
- Precise Android Text Drawing
- Font Metrics in Java (and Android)
- Layout documentation
- Java: FontMetrics ascent incorrect?
- FontMetrics not correct when run on android device. Simulator fine
- Java Font Metrics (Java doesn't seem to use
top
andbottom
)
这篇关于含义顶部,上升,基准线,血统,底部,并引领Android的的FontMetrics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!