diff options
author | Jonah Graham | 2021-11-09 17:58:22 +0000 |
---|---|---|
committer | Niraj Modi | 2021-11-30 14:40:31 +0000 |
commit | cc056e1da587e2b4f6cf9d7269db2708083311c7 (patch) | |
tree | 47120bcb41112a196b39c5758bbd7030d259674d | |
parent | 2dfe00fe1816b13fc40d400c3e8d27f78da972e7 (diff) | |
download | eclipse.platform.swt-cc056e1da587e2b4f6cf9d7269db2708083311c7.tar.gz eclipse.platform.swt-cc056e1da587e2b4f6cf9d7269db2708083311c7.tar.xz eclipse.platform.swt-cc056e1da587e2b4f6cf9d7269db2708083311c7.zip |
Bug 577238: Detect when ScriptShape has failed to shape output
Much of the OS.Script* (usp10.h methods) are missing error handling.
This patch set adds checking result of ScriptShape in main use case.
This patchset converts silent failure (blank line/segment) with
a hard error forcing fallback onto other shaping options.
Had this error checking been in place we probably would have detected
the issues in Bug 23406 sooner.
Change-Id: I9cb17ab0a56dfd1ebdb513222d9d4b3f27a7bf2e
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/187694
Tested-by: Niraj Modi <niraj.modi@in.ibm.com>
Reviewed-by: Niraj Modi <niraj.modi@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index 00cd1c628c..c5d71ca5ba 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -3450,11 +3450,18 @@ boolean shape (long hdc, StyleItem run, char[] chars, int[] glyphCount, int maxG return false; } } - int hr = OS.ScriptShape(hdc, run.psc, chars, chars.length, maxGlyphs, run.analysis, run.glyphs, run.clusters, run.visAttrs, glyphCount); - run.glyphCount = glyphCount[0]; - if (useCMAPcheck) return true; + int scriptShaprHr = OS.ScriptShape(hdc, run.psc, chars, chars.length, maxGlyphs, run.analysis, run.glyphs, + run.clusters, run.visAttrs, glyphCount); + if (scriptShaprHr == OS.S_OK) { + run.glyphCount = glyphCount[0]; + if (useCMAPcheck) return true; - if (hr != OS.USP_E_SCRIPT_NOT_IN_FONT) { + /* + * scriptShapeHr could have been OS.USP_E_SCRIPT_NOT_IN_FONT which indicates + * the whole run doesn't work with the font. The rest of this method verifies that + * none of the individual glyphs are missing an entry in the font. + * The fallback is to try other fonts (See caller) + */ if (run.analysis.fNoGlyphIndex) return true; SCRIPT_FONTPROPERTIES fp = new SCRIPT_FONTPROPERTIES (); fp.cBytes = SCRIPT_FONTPROPERTIES.sizeof; |