Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

练习最后一道题有疑问Sample14GetFontMetricsView #4

Open
allenzhangp opened this issue Feb 17, 2019 · 2 comments
Open

练习最后一道题有疑问Sample14GetFontMetricsView #4

allenzhangp opened this issue Feb 17, 2019 · 2 comments

Comments

@allenzhangp
Copy link

在Sample14GetFontMetricsView中计算yOffset的用的是
yOffset = - (fontMetrics.ascent + fontMetrics.descent) / 2;
之前你在文章里写的ascent是负数,descent是正数,这两个相加是什么意思,计算baseline吗?不太懂。
如果是计算baseline应该只要ascent就可以了吧,而且canvas.drawText方法,里面的y就是baseline的值,搞不懂?!

@allenzhangp allenzhangp changed the title 联系最后一道题有疑问Sample14GetFontMetricsView 练习最后一道题有疑问Sample14GetFontMetricsView Feb 18, 2019
@loopq
Copy link

loopq commented Feb 18, 2019

而且 Sample14GetFontMetricsView 实现的效果和13的效果不一致,14没有全部字体居中,不知道是不是刻意这样的。

@loopq
Copy link

loopq commented Feb 18, 2019

然后你的关于「yOffset = - (fontMetrics.ascent + fontMetrics.descent) / 2;」的疑问看一下https://blog.csdn.net/qq_36713816/article/details/79104716

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants