Commit Graph

278 Commits

Author SHA1 Message Date
Ricardo Quesada 35008702bf fix: underline will have the same solor as text in TTF
underline will have the same solor as text in TTF when calling
`setColor`. There is another method called `setTextColor` which is
confusing. What does each function?

github issue #15214
2016-06-17 17:23:59 -07:00
子龙山人 51f4deee01 Add system label overflow (#15827)
* Add system font overflow

1. currently only iOS, Mac and Android platform are supported

add mac label overflow shrink

modify system font overflow test

fix warning and possible memory leaks

add ios system label overflow support

add iOS system font overflow support

fix iOS system font overflow

fix Mac System font overflow

add android system font clamp

add Android system font shrink

cleanup iOS shrink related code

fix Android system font clamp

add core text to project template

fix iOS tests project

fix mac and iOS shrink

improve iOS and Mac clamp feature

fix header file include path

* modify the comments, make it more clearer
2016-06-15 10:43:15 +08:00
Xpol Wan 1cc0130bdd Fixes signed/unsigned mismatch warnings.
```
2d\CCFontFNT.cpp(328): warning C4018: '<' : signed/unsigned mismatch
2d\CCLabel.cpp(782): warning C4018: '>' : signed/unsigned mismatch
2d\CCLabel.cpp(784): warning C4018: '<' : signed/unsigned mismatch
scripting\js-bindings\manual\cocos2d_specifics.cpp(2741): warning C4018: '<' : signed/unsigned mismatch
tests\cpp-tests\Classes\Sprite3DTest\Sprite3DTest.cpp(1969): warning C4018: '>=' : signed/unsigned mismatch
tests\cpp-tests\Classes\TextInputTest\TextInputTest.cpp(264): warning C4018: '>=' : signed/unsigned mismatch
ui\UIEditBox\UIEditBoxImpl-common.cpp(113): warning C4018: '<' : signed/unsigned mismatch
ui\UIRichText.cpp(1573): warning C4018: '<=' : signed/unsigned mismatch
ui\UITextField.cpp(89): warning C4018: '>=' : signed/unsigned mismatch
```
2016-04-26 17:53:25 +08:00
mogemimi f9f751834a Add missing float suffix to avoid warning C4305 2016-04-20 03:54:47 +09:00
Xpol Wan 8c3137b07f Fixes warning about unused static constants. 2016-04-18 15:38:51 +08:00
zilongshanren ff6b7080f5 fix systemFontDirty and lineBreakMode issue 2016-03-22 14:47:33 +08:00
zilongshanren a15a39095f fix system font dirty issue 2016-03-21 22:31:23 +08:00
Vladimir Perminov b3b047e9ad Label '\b' - Next char not change x position
Add TextFormatter for easy use '\n', '\r', '\b'
2016-03-07 14:07:36 +03:00
Ricardo Quesada 4c11432781 fixed bold 2016-01-20 19:08:31 -08:00
Ricardo Quesada 60d273e31b underline and strikethrough working ok on system fonts 2016-01-20 18:41:59 -08:00
Ricardo Quesada 27c8e5227d Adds xml support in UIRichText
Supported tags:
- <small>: makes the font 20% smaller
- <big>: makes the font 25% bigger
- <img src="" />: to add an image
- <font face="path to font" size="size" color="#00ffaa">: font
  attributes
- <i>: italics
- <b>: bold
- <u>: underline
- <del> strike-through
- </br>: new line

Also adds support for strikethrough, italics, bold and underlie to
`Label`

Contains tests for UIRichText and Label

Squashed commit of the following:

commit a0d6ae0513d40dbf414930210ab032a49d8984a0
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 19 20:39:21 2016 -0800

    cleanup LabelTestNew

commit 0cf423af85d88a42fc1317207feeb3d05da7f8ab
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 19 20:34:53 2016 -0800

    adds maaaany tests

    ...and fixes width and height in <img src="">

commit e8ba6acd5d79bbc766d7aa02ef166e166c801d01
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 15 19:41:37 2016 -0800

    Label + URL working Ok

commit 36689e29ee3d77310e92264a09084cc06e30664c
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 15 18:24:44 2016 -0800

    adding this code just in case...

    ... should use a listener component instead

commit af03708950e74483b875d0baad593aa6ed242a04
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Thu Jan 14 20:23:36 2016 -0800

    URL node

    plus <de><u> and <a img

commit e3a4930b012c0b3756752dac6ffb5ad43d24ae99
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Wed Jan 13 18:42:18 2016 -0800

    strikethrough and underline implemented

    they support multiline and horizontal alignment as well
    includes test
    however vertical alignment might not work

commit 640ccf39f56e153db46785a61be7000e898174c7
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 18:14:57 2016 -0800

    bug fixes

commit 5e41fb76e91c571639585a609a255eb41797a302
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 16:47:20 2016 -0800

    adds italics and bold "disable test"

commit 202c5a45bb9c8ea160b9f6880ef858874e07814b
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Tue Jan 12 14:40:13 2016 -0800

    adds italics test

commit d1a8b421445053cc36860fc376f52692a3672dfe
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Mon Jan 11 20:53:23 2016 -0800

    italics is working ok

commit fdd02087fce920c27c2409301ec88685fe68085b
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Fri Jan 8 17:18:56 2016 -0800

    color, size and face working

commit c01bdef6b1d49f8805b69d4c162b74cd00c8f5b3
Author: Ricardo Quesada <ricardoquesada@gmail.com>
Date:   Thu Jan 7 19:02:16 2016 -0800

    initial commit
2016-01-19 20:41:31 -08:00
XiaoFeng ab0efd933a Merge branch 'v3.10' of https://github.com/cocos2d/cocos2d-x into v3
Conflicts:
	CHANGELOG
	cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp
	tests/js-tests/src/RenderTextureTest/RenderTextureTest.js
2016-01-09 18:01:56 +08:00
zilongshanren 100a119181 add overFlow enum to jsb and lua.
1. change clamp to 1 and shrink to 2
2016-01-04 21:43:37 +08:00
pandamicro 022bcc24f1 Merge branch 'v3.10' of github.com:cocos2d/cocos2d-x into v3
Conflicts:
	cocos/scripting/js-bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp
	cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp
	cocos/scripting/js-bindings/manual/js_bindings_opengl.cpp
2015-12-20 22:56:33 +08:00
Wenhai Lin b91882f150 Fixed label's letter can't be hide by `setVisible(false)`. 2015-12-16 14:59:33 +08:00
zilongshanren b1d700ad33 fix bmfont size error 2015-12-13 13:59:42 +08:00
Liam e92db43e14 update for text clone 2015-12-10 13:17:31 +08:00
mogemimi f280a31323 Fix typo in documentation and comments 2015-12-09 01:48:24 +09:00
zilongshanren 6c17ef4baf fix horizontal clamp and shrink issue 2015-12-07 18:13:03 +08:00
Ricardo Quesada 48523572b7 label JS fixes 2015-12-02 17:23:23 -08:00
zilongshanren ed55d41858 fix label clamp when scaled with bmfont 2015-12-02 13:48:20 +08:00
zilongshanren 5221f8a6fc improve the code by code review suggestions. 2015-11-26 12:03:18 +08:00
zilongshanren 7ee82f20fc fix getLetter crash issue.
1. make vertical clamp works in non-wrap mode.

2. make the lineHeight and letterSprite scale work correct.
2015-11-20 16:39:48 +08:00
zilongshanren 8c25749366 minor improvement 2015-11-20 10:54:05 +08:00
zilongshanren 19257d6120 Add Overflow feature char map font.
1. fix single line clamp.
2015-11-19 18:14:46 +08:00
zilongshanren ccdb2a75f9 Add Label Overflow and wrap option.
Squashed commit of the following:

commit 7176582def3686f78701f92ead4d0976bccd115d
Author: zilongshanren <guanghui8827@126.com>
Date:   Thu Nov 19 10:30:54 2015 +0800

    add char map font test

commit 7ea7c251ff549e4a74d5c5c3faa49893fe5defc4
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 18 15:00:17 2015 +0800

    system font overflow is not supported

commit a02fe0c7f94692b95a0bfd6f194a94c4519cee3a
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 18 11:04:15 2015 +0800

    add system font test

commit eb098da8b16f485c86929a9b2ba00a64068264e9
Author: zilongshanren <guanghui8827@126.com>
Date:   Tue Nov 17 10:29:35 2015 +0800

    Finish resize height mode

commit ca78ba35abdbacc23bf6f8315454ec0a356a6aca
Author: zilongshanren <guanghui8827@126.com>
Date:   Mon Nov 16 11:01:27 2015 +0800

    fix wrap issue

commit baf1a5e0dc3a08da0a13500aea5afc82017b054a
Author: zilongshanren <guanghui8827@126.com>
Date:   Sat Nov 14 08:28:57 2015 +0800

    horizontal shrink still has a issue

commit 7e8abc0990cdf299d23c8072c5c1d4aa561bf798
Author: zilongshanren <guanghui8827@126.com>
Date:   Fri Nov 13 11:42:34 2015 +0800

    finish shrink without wrap

commit c9c45bd1f304ba00a6f9a274fa5631659a075bc1
Author: zilongshanren <guanghui8827@126.com>
Date:   Fri Nov 13 10:09:46 2015 +0800

    update shrink

commit ad82010ea846679e4d1a09f5127be29ae2e6adae
Author: zilongshanren <guanghui8827@126.com>
Date:   Thu Nov 12 17:55:15 2015 +0800

    refactor shrink logic

commit effc1ee1cd9f06eaa4f46dd5c2a1401f6a285af6
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 11 18:25:34 2015 +0800

    add resize overflow type

commit 194d552adc2a4ba2c439eff969b082556315e0ae
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 11 11:49:51 2015 +0800

    no wrap, shrink is working.

commit e2222ef14d5392817bd727895b3c2caec5ce4faf
Author: zilongshanren <guanghui8827@126.com>
Date:   Tue Nov 10 16:16:27 2015 +0800

    add overflow type to label.

    1. optimize the testcase

commit b65e2de4bfb3cb86a0d0cfa118be891a3f9fe858
Author: zilongshanren <guanghui8827@126.com>
Date:   Mon Nov 9 17:22:34 2015 +0800

    finish bmfont wrap by char

commit f339ff0309dc9e2ca2871f03f4551d329afce5e1
Author: zilongshanren <guanghui8827@126.com>
Date:   Mon Nov 9 17:04:51 2015 +0800

    finish bmfont wrap by word

commit 4c8edc65204a1294ac81315e72f1299acbdf43c0
Author: zilongshanren <guanghui8827@126.com>
Date:   Mon Nov 9 11:29:21 2015 +0800

    add BMFont size support

commit 3282481bda9dcb0f88b41f2568f7e5c856af6d53
Author: zilongshanren <guanghui8827@126.com>
Date:   Mon Nov 9 09:58:01 2015 +0800

    add font size support for BMFONT

commit 0c8e2a0374983625507a183cb2eb53a0b1709e25
Author: zilongshanren <guanghui8827@126.com>
Date:   Fri Nov 6 16:36:27 2015 +0800

    add toggle wrap option.

    1. make hirozontal clamp working

commit 19dcd3e80a34c54b20934d08937eb270e689a7db
Author: zilongshanren <guanghui8827@126.com>
Date:   Fri Nov 6 15:12:59 2015 +0800

    tweak label layout

commit e36a40babf4817ea7e9830614ac7560f2e69c583
Author: zilongshanren <guanghui8827@126.com>
Date:   Thu Nov 5 11:11:02 2015 +0800

    finish the test skeleton

commit a144a3a5d388d15c4f37cbfc12563eccabffb8e1
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 4 16:38:54 2015 +0800

    add setFontSize api to label.

    1. add new chinese-english bmfont
    2. beautify base test

commit b22551c9eb3738fbb1c38ae4a3bfd07a202dcaf0
Author: zilongshanren <guanghui8827@126.com>
Date:   Wed Nov 4 11:27:18 2015 +0800

    add label layout test skeleton
2015-11-19 16:06:13 +08:00
pandamicro 82881bf92f Merge pull request #14109 from loadrunner/label3
Added line spacing/leading feature to Label
2015-10-19 10:55:53 +08:00
pandamicro 5e43cfa129 Merge pull request #14107 from loadrunner/label1
Removed scale factor for label shadow
2015-10-13 11:54:14 +08:00
Danut Chereches 471c23930c added line spacing/leading 2015-10-10 19:15:45 +03:00
mogemimi 9f768bc1ab Add missing override keyword 2015-10-02 18:18:23 +09:00
Danut Chereches 8944f9e1cd removed scale factor for label shadow 2015-09-28 16:27:20 +03:00
WenhaiLin 827f05c5e1 Fixed `Label::setGlobalZOrder ` is invalid when label create with system font. 2015-08-19 10:22:48 +08:00
WenhaiLin 6bf15885b8 Fixed `Label::getLetter(index)->setVisible(true)` cause draws duplicate letters. 2015-08-18 15:42:05 +08:00
WenhaiLin c06994de34 Label:Fixed display incorrect if label content is changed after invoking `getLetter(letterIndex)` 2015-08-13 10:29:58 +08:00
WenhaiLin eeb4a38715 Label:Fixed letter can be flipped. 2015-08-11 10:06:14 +08:00
Wenhai Lin 2983aed0a9 Label:Fixed crash cause by access an invalid address 2015-08-10 16:50:59 +08:00
WenhaiLin b9edd6fc29 Fixed transform 2015-08-05 00:21:06 +08:00
WenhaiLin 2363622a67 Label:support auto batch with bitmap font or char map. 2015-08-04 21:49:14 +08:00
pandamicro 39721c6eb6 Merge pull request #13105 from fusijie/fix_10487
fix Sprite/Label/FastTMX auto-culling bug.
2015-07-30 17:12:37 +08:00
fusijie f91a58c8ff fix Label auto-culling bug. 2015-07-30 13:59:50 +08:00
WenhaiLin 964e7103b5 Improve coding style 2015-07-30 11:33:18 +08:00
WenhaiLin a9f27865d3 Fixed the content size of Label is incorrect with GLOW effect. 2015-07-29 16:30:07 +08:00
WenhaiLin 37a174ee4a Label:refine the implementation about text layout and support debug draw 2015-07-24 18:38:45 +08:00
WenhaiLin 63326c2826 Label:Fixed opacity setting is invalid with bitmap font. 2015-07-20 11:10:17 +08:00
WenhaiLin 731de26795 Label:Fixed system font may be invisible when there are multiple cameras. 2015-07-17 17:45:11 +08:00
WenhaiLin d5d5af5ac3 change ‘auto’ to ‘auto&&’ 2015-07-16 14:08:59 +08:00
WenhaiLin 1c9a181c35 Label:Fixed the color of letter will be overridden by fade action. 2015-07-15 20:17:05 +08:00
WenhaiLin b701fd9e73 Fixed compile error 2015-07-14 13:47:35 +08:00
WenhaiLin 964713355b Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3-label-createfail 2015-07-14 13:43:43 +08:00
WenhaiLin d4f62a8063 Label:improving the code readability. 2015-07-14 11:30:56 +08:00