Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Line-break ideographic text by character - #6828

Merged
1ec5 merged 4 commits into
masterfrom
1ec5-換行-1223
Nov 14, 2016

Hidden character warning

The head ref may contain hidden characters: "1ec5-\u63db\u884c-1223"
Merged

1ec5 merged 4 commits into
masterfrom
1ec5-換行-1223

Conversation

@1ec5

@1ec5 1ec5 commented Oct 26, 2016 •

Copy link
Copy Markdown
Contributor

Automatically insert a line break after any supported Chinese, Japanese, or Yi character in a point-placed label as needed to stay within the text-max-width. Balance the lines unless non-ideographic text such as Latin letters are present.

golf
Compare the label on the map to the popover title, which shows the queried feature’s name. A line break is absent from the feature but applied automatically by the renderer.

Ported from mapbox/mapbox-gl-js#3420. Fixes #1223. Depends on mapbox/mapbox-gl-test-suite#153.

Before merging:

/cc @lucaswoj @xrwang

@1ec5 1ec5 added Core The cross-platform C++ core, aka mbgl Google Maps parity For feature parity with the Google Maps SDK for Android or iOS labels Oct 26, 2016
@1ec5 1ec5 self-assigned this Oct 26, 2016
@mention-bot

Copy link
Copy Markdown

@1ec5, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jfirebaugh, @kelvinabrokwa and @kkaefer to be potential reviewers.

kkaefer
kkaefer previously approved these changes Oct 27, 2016
Comment thread src/mbgl/util/i18n.hpp Outdated
namespace i18n {

/// Returns whether a line break can be inserted after any character in the given string.
/// If false, line breaking should occur on word boundaries instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not using triple slashes in core

Comment thread src/mbgl/text/glyph_set.cpp Outdated
|| shape.glyph == 0x200b /* zero-width space */
|| shape.glyph == 0x2010 /* hyphen */
|| shape.glyph == 0x2013 /* en dash */) {
|| shape.glyph == 0x2013 /* en dash */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move all of those as well to a sister function of allowsIdeographicBreaking in the i18n namespace

@kkaefer
kkaefer dismissed their stale review October 27, 2016 23:23

Failing tests

@1ec5

1ec5 commented Oct 27, 2016

Copy link
Copy Markdown
Contributor Author

The failing test is:

@brunoabinader

Copy link
Copy Markdown
Contributor

Worth noticing I am temporarily ignoring text-max-width/ideographic-breaking for GL native as part of updating mesa to use OSMesa: mapbox/mapbox-gl-test-suite@51546ca. We can undo it once this PR gets merged.

@jfirebaugh

Copy link
Copy Markdown
Contributor

The test-suite failure was prexisting. It's tracked in #6796 and the test case is now ignored for native. If you rebase this PR, I expect test-suite will pass.

Was that the only remaining obstacle to merging this?

@1ec5

1ec5 commented Nov 7, 2016

Copy link
Copy Markdown
Contributor Author

Was that the only remaining obstacle to merging this?

I also need to address @kkaefer’s feedback, but that should be it.

@kkaefer

kkaefer commented Nov 10, 2016

Copy link
Copy Markdown
Member

Are there any tests that specifically test breaking by character?

@1ec5

1ec5 commented Nov 10, 2016

Copy link
Copy Markdown
Contributor Author

There are rendering tests in the test suite for the overall ideographic breaking feature, but no comprehensive test that goes character by character. The rendering tests were disabled on the native side in mapbox/mapbox-gl-test-suite@3b005f1, but I verified that they passed before pinning to that commit.

@kkaefer

kkaefer commented Nov 10, 2016

Copy link
Copy Markdown
Member

Can we enable these tests when merging?

@1ec5

1ec5 commented Nov 10, 2016

Copy link
Copy Markdown
Contributor Author

Yes, it's on the to-do list above.

@1ec5 1ec5 added this to the android-v4.2.0 milestone Nov 12, 2016
@1ec5

1ec5 commented Nov 12, 2016

Copy link
Copy Markdown
Contributor Author

Putting this on the Android SDK v4.2.0 milestone because it blocks #6996.

@kkaefer

kkaefer commented Nov 14, 2016

Copy link
Copy Markdown
Member

@1ec5 any reason why we're not reenabling the tests as part of this PR rather than doing to after merge?

1ec5 added a commit to mapbox/mapbox-gl-test-suite that referenced this pull request Nov 14, 2016
@1ec5

1ec5 commented Nov 14, 2016

Copy link
Copy Markdown
Contributor Author

any reason why we're not reenabling the tests as part of this PR rather than doing to after merge?

OK, I’ve pointed this PR to the 1ec5-換行-1223 branch in gl-test-suite, in which I’ve reenabled the tests. Once I get the green light, I’ll fast-forward-merge that branch, then update the commit hash in package.json, then merge this PR.

@jfirebaugh jfirebaugh removed this from the android-v4.2.0 milestone Nov 14, 2016
1ec5 added a commit to mapbox/mapbox-gl-test-suite that referenced this pull request Nov 14, 2016
1ec5 added 4 commits November 14, 2016 14:29
Allow a line break to be inserted after any supported Chinese, Japanese, or Yi character in a point-placed label. Balance the lines unless non-ideographic text such as Latin letters are present.

Fixes #1223.
@1ec5
1ec5 merged commit dbd2235 into master Nov 14, 2016
@1ec5
1ec5 deleted the 1ec5-換行-1223 branch November 14, 2016 22:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS Google Maps parity For feature parity with the Google Maps SDK for Android or iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants