Skip to content

Commit

Permalink
Merge pull request #7280 from andreborud/emojis
Browse files Browse the repository at this point in the history
Added full UTF-8 support in Labels
  • Loading branch information
mramato authored Oct 25, 2019
2 parents af4c339 + 301c28a commit 67cdd49
Show file tree
Hide file tree
Showing 5 changed files with 1,761 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ _This is an npm-only release to fix a publishing issue_.
* Added `computeLineSegmentLineSegmentIntersection` to `Intersections2D`. [#7228](https://github.com/AnalyticalGraphicsInc/Cesium/pull/7228)
* Added ability to load availability progressively from a quantized mesh extension instead of upfront. This will speed up load time and reduce memory usage. [#7196](https://github.com/AnalyticalGraphicsInc/cesium/pull/7196)
* Added the ability to apply styles to 3D Tilesets that don't contain features. [#7255](https://github.com/AnalyticalGraphicsInc/Cesium/pull/7255)
* Added support for emojis in Labels.

##### Fixes :wrench:
* Fixed issue causing polyline to look wavy depending on the position of the camera [#7209](https://github.com/AnalyticalGraphicsInc/cesium/pull/7209)
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Qiming Zhang](https://github.com/bbbbx)
* [Chris Wingler](https://github.com/chriswingler)
* [Tinco Andringa](https://github.com/tinco)
* [André Borud](https://github.com/andreborud)
14 changes: 14 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -971,3 +971,17 @@ https://github.com/logos
### Font Awesome Icon

Font Awesome by Dave Gandy - http://fontawesome.io

### GraphemeSplitter

https://github.com/orling/grapheme-splitter

> The MIT License (MIT)
>
> Copyright (c) 2015 Orlin Georgiev
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 6 additions & 2 deletions Source/Scene/LabelCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import LabelStyle from './LabelStyle.js';
import SDFSettings from './SDFSettings.js';
import TextureAtlas from './TextureAtlas.js';
import VerticalOrigin from './VerticalOrigin.js';
import GraphemeSplitter from '../ThirdParty/graphemesplitter.js';

// A glyph represents a single character in a particular label. It may or may
// not have a billboard, depending on whether the texture info has an index into
Expand Down Expand Up @@ -109,9 +110,12 @@ import VerticalOrigin from './VerticalOrigin.js';
});
}

var splitter = new GraphemeSplitter();

function rebindAllGlyphs(labelCollection, label) {
var text = label._renderedText;
var textLength = text.length;
var graphemes = splitter.splitGraphemes(text);
var textLength = graphemes.length;
var glyphs = label._glyphs;
var glyphsLength = glyphs.length;

Expand Down Expand Up @@ -173,7 +177,7 @@ import VerticalOrigin from './VerticalOrigin.js';
// walk the text looking for new characters (creating new glyphs for each)
// or changed characters (rebinding existing glyphs)
for (textIndex = 0; textIndex < textLength; ++textIndex) {
var character = text.charAt(textIndex);
var character = graphemes[textIndex];
var verticalOrigin = label._verticalOrigin;

var id = JSON.stringify([
Expand Down
Loading

0 comments on commit 67cdd49

Please sign in to comment.