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

Fix the effect of label with outline in CHAR mode. #4550

Merged
merged 2 commits into from Jun 11, 2019

Conversation

@caryliu1999
Copy link
Contributor

commented Jun 4, 2019

Before:
v2.0.10 / fontSize: 20 / outLine width: 2

1559639968763

After:
after

caryliu1999 added some commits Jun 4, 2019

@jareguo

This comment has been minimized.

Copy link
Contributor

commented Jun 6, 2019

edge cropping 的问题,感觉突出一个像素就可以了吧?

@2youyou2 2youyou2 merged commit a1fac03 into cocos-creator:v2.1.2 Jun 11, 2019

1 check passed

ci/circleci: test Your tests passed on CircleCI!
Details
@caryliu1999

This comment has been minimized.

Copy link
Contributor Author

commented Jun 11, 2019

edge cropping 的问题,感觉突出一个像素就可以了吧?

绘制缓存字符的时候一开始是没有预留宽度的,直接用文字的实际宽度,所以描边会被完全裁切掉。

修改的第一版本字符缓存的canvas增加outline.width的宽度,相当于两边都是outline.width/2的空间,但是最边缘会有一点点的裁切。

目前是字符缓存的canvas都预留outline.width * 2的宽度,相当于两边都是outline.width的空间,能保证描边被完全绘制出来。然后取字符进行文本内容拼接的时候,字符会向左偏移outline.width,来抵消字符canvas size增加产生的间隙。node的contentSize计算跟NONE模式保持一致,整个canvas增加outline.width * 2的宽度。

knoxHuang added a commit to knoxHuang/engine-2 that referenced this pull request Jun 19, 2019

Fix the effect of label with outline in CHAR mode. (cocos-creator#4550)
* Fix the effect of label with outline in CHAR mode.

* fix edge cropping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.