Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(311)

Issue 5797066: Add CreateFallbackForScript to SkTypeface for Android. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by Hao Zheng
Modified:
12 years, 6 months ago
Reviewers:
bungeman, russell, DerekS, reed1
CC:
skia-review_googlegroups.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Add CreateFallbackForScript to SkTypeface for Android. WebKit uses HarfBuzz directly to do Complex Text Layout, so it needs to get the proper SkTypeface to pass it to HarfBuzz. However, on Android, fallback scripts have no name, and we can only get them by file name each time (CreateFromFile). This actually breaks the semantics of SkTypeface, which states 'The ID should be unique for the underlying font file/data, not unique per typeface instance.' And add 2 helper function to convert between FallbackScripts enum and font file name. These are useful for WebKit's FontCache, which needs string as key. BUG=525

Patch Set 1 #

Total comments: 9

Patch Set 2 : #

Patch Set 3 : #

Total comments: 1

Patch Set 4 : #

Total comments: 7

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+112 lines, -0 lines) Patch
A include/ports/SkTypeface_android.h View 1 2 3 4 1 chunk +52 lines, -0 lines 0 comments Download
M src/ports/SkFontHost_android.cpp View 1 2 3 4 6 chunks +60 lines, -0 lines 0 comments Download

Messages

Total messages: 27
Hao Zheng
12 years, 7 months ago (2012-03-12 10:56:12 UTC) #1
reed1
Looks fine to me. Since this is definitely android-specific (no other port even uses the ...
12 years, 7 months ago (2012-03-12 12:27:50 UTC) #2
DerekS
https://codereview.appspot.com/5797066/diff/1/src/ports/SkFontHost_android.cpp File src/ports/SkFontHost_android.cpp (right): https://codereview.appspot.com/5797066/diff/1/src/ports/SkFontHost_android.cpp#newcode495 src/ports/SkFontHost_android.cpp:495: static void map_fallback_scripts(const char fileName[], const uint32_t uniqueID) { ...
12 years, 7 months ago (2012-03-12 13:40:22 UTC) #3
Hao Zheng
PTAL https://codereview.appspot.com/5797066/diff/1/include/core/SkTypeface.h File include/core/SkTypeface.h (right): https://codereview.appspot.com/5797066/diff/1/include/core/SkTypeface.h#newcode123 include/core/SkTypeface.h:123: enum FallbackScript { On 2012/03/12 12:27:50, reed1 wrote: ...
12 years, 6 months ago (2012-03-13 06:29:10 UTC) #4
Hao Zheng
Added 2 helper function to convert between FallbackScripts enum and font file name. These are ...
12 years, 6 months ago (2012-03-13 13:11:22 UTC) #5
reed1
lgtm perhaps in the future, we can extend the existing xml file to include an ...
12 years, 6 months ago (2012-03-13 13:48:26 UTC) #6
Hao Zheng
On 2012/03/13 13:48:26, reed1 wrote: > lgtm > > perhaps in the future, we can ...
12 years, 6 months ago (2012-03-13 14:00:06 UTC) #7
Hao Zheng
https://codereview.appspot.com/5797066/diff/1007/src/ports/SkFontHost_android.cpp File src/ports/SkFontHost_android.cpp (right): https://codereview.appspot.com/5797066/diff/1007/src/ports/SkFontHost_android.cpp#newcode497 src/ports/SkFontHost_android.cpp:497: memset(gFallbackScriptsMap, 0, sizeof(gFallbackScriptsMap)); Sorry, sizeof(gFallbackScriptsMap) is 4 here... Change ...
12 years, 6 months ago (2012-03-13 15:36:57 UTC) #8
russell
https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp File src/ports/SkFontHost_android.cpp (right): https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp#newcode433 src/ports/SkFontHost_android.cpp:433: }; I'm reluctant to put a hard-coded list of ...
12 years, 6 months ago (2012-03-13 22:17:48 UTC) #9
Hao Zheng
On 2012/03/13 22:17:48, russell wrote: > https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp > File src/ports/SkFontHost_android.cpp (right): > > https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp#newcode433 > ...
12 years, 6 months ago (2012-03-14 04:35:34 UTC) #10
DerekS
I already have a bug (b/5956665) to address a problem similar to this for fonts. ...
12 years, 6 months ago (2012-03-14 13:00:09 UTC) #11
reed1
Would the following API additions be sufficient for clank's needs? 1. Iterator, which returns each ...
12 years, 6 months ago (2012-03-14 16:20:50 UTC) #12
russell
https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp File src/ports/SkFontHost_android.cpp (right): https://codereview.appspot.com/5797066/diff/5003/src/ports/SkFontHost_android.cpp#newcode433 src/ports/SkFontHost_android.cpp:433: }; Instead of an enum, we could use something ...
12 years, 6 months ago (2012-03-14 16:54:17 UTC) #13
russell
I think that these additions would allow webkit to stop mapping scripts to a hardcoded ...
12 years, 6 months ago (2012-03-14 17:08:45 UTC) #14
Hao Zheng
On 2012/03/14 16:20:50, reed1 wrote: > Would the following API additions be sufficient for clank's ...
12 years, 6 months ago (2012-03-15 04:29:40 UTC) #15
Hao Zheng
On 2012/03/15 04:29:40, zhenghao wrote: > On 2012/03/14 16:20:50, reed1 wrote: > > Would the ...
12 years, 6 months ago (2012-03-15 04:30:55 UTC) #16
reed1
Indeed. My proposal is that webkit is then free to create whatever mapping structure it ...
12 years, 6 months ago (2012-03-15 12:09:00 UTC) #17
Hao Zheng
On 2012/03/15 12:09:00, reed1 wrote: > Indeed. My proposal is that webkit is then free ...
12 years, 6 months ago (2012-03-15 12:15:30 UTC) #18
DerekS
After talking with Mike I think he just wanted to have his proposed API made ...
12 years, 6 months ago (2012-03-15 14:05:32 UTC) #19
Hao Zheng
On 2012/03/15 14:05:32, djsollen wrote: > After talking with Mike I think he just wanted ...
12 years, 6 months ago (2012-03-15 14:09:23 UTC) #20
DerekS
Mike is working on the new API now and I'll be glad to change the ...
12 years, 6 months ago (2012-03-15 14:58:22 UTC) #21
Hao Zheng
Sorry, I don't have a list of character codes to detect the script. I learned ...
12 years, 6 months ago (2012-03-15 15:09:15 UTC) #22
DerekS
I can make sure the string is unique when I rework the implementation. I can ...
12 years, 6 months ago (2012-03-15 15:12:13 UTC) #23
Hao Zheng
Done. I removed some constraints on return value of SkGetFallbackScriptID, because I'm not sure how ...
12 years, 6 months ago (2012-03-15 15:25:17 UTC) #24
DerekS
On 2012/03/15 15:25:17, zhenghao wrote: > Done. I removed some constraints on return value of ...
12 years, 6 months ago (2012-03-15 15:50:23 UTC) #25
Hao Zheng
On 2012/03/15 15:50:23, djsollen wrote: > On 2012/03/15 15:25:17, zhenghao wrote: > > Done. I ...
12 years, 6 months ago (2012-03-16 04:01:44 UTC) #26
russell
12 years, 6 months ago (2012-03-16 16:23:09 UTC) #27
I like this new idea, a lot. After a quick scan of font files using FontForge,
it looks like all of the scripts can be determined from their block signatures.


On 2012/03/16 04:01:44, zhenghao wrote:
> Thanks, Derek. I got a new idea of detecting the script from font files. Font
> files have glyphs block, and we can use the block name to detect the script.
For
> example, DroidSansThai.ttf has 4 blocks in fontmatrix: 'Basic Latin', 'Thai',
> 'General Punctuation', 'Geometric Shapes'.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b