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

@caryliu1999 caryliu1999 commented Jun 4, 2019

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

1559639968763

After:
after

@jareguo
Copy link
Member

@jareguo jareguo commented Jun 6, 2019

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

Loading

@2youyou2 2youyou2 merged commit a1fac03 into cocos-creator:v2.1.2 Jun 11, 2019
1 check passed
Loading
@caryliu1999
Copy link
Contributor Author

@caryliu1999 caryliu1999 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的宽度。

Loading

knoxHuang added a commit to knoxHuang/engine-2 that referenced this issue Jun 19, 2019
* Fix the effect of label with outline in CHAR mode.

* fix edge cropping.
@caryliu1999 caryliu1999 deleted the v2.1.2-fix-char branch Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants