-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avm2: Check the text.engine.FontDescription properties before setting
- Loading branch information
1 parent
061b7f9
commit 28a3c71
Showing
5 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package { | ||
import flash.display.Sprite; | ||
import flash.text.engine.*; | ||
|
||
public class Test extends Sprite { | ||
public function Test():void { | ||
var font = new FontDescription(); | ||
|
||
var properties = ["cffHinting", "fontLookup", "fontName", "fontPosture", "fontWeight", "renderingMode"]; | ||
for each (var prop in properties) { | ||
trace("// FontDescription::" + prop) | ||
|
||
try { | ||
font[prop] = null; | ||
} catch (e) { | ||
trace(e); | ||
} | ||
|
||
try { | ||
font[prop] = "<invalid>"; | ||
} catch (e) { | ||
trace(e); | ||
} | ||
} | ||
|
||
font.cffHinting = CFFHinting.NONE; | ||
trace("// cffHinting: " + font.cffHinting); | ||
font.cffHinting = CFFHinting.HORIZONTAL_STEM; | ||
trace("// cffHinting: " + font.cffHinting); | ||
|
||
font.fontLookup = FontLookup.DEVICE; | ||
trace("// fontLookup: " + font.fontLookup); | ||
font.fontLookup = FontLookup.EMBEDDED_CFF; | ||
trace("// fontLookup: " + font.fontLookup); | ||
|
||
font.fontPosture = FontPosture.NORMAL; | ||
trace("// fontPosture: " + font.fontPosture); | ||
font.fontPosture = FontPosture.ITALIC; | ||
trace("// fontPosture: " + font.fontPosture); | ||
|
||
font.fontWeight = FontWeight.NORMAL; | ||
trace("// fontWeight: " + font.fontWeight); | ||
font.fontWeight = FontWeight.BOLD; | ||
trace("// fontWeight: " + font.fontWeight); | ||
|
||
font.renderingMode = RenderingMode.NORMAL; | ||
trace("// renderingMode: " + font.renderingMode); | ||
font.renderingMode = RenderingMode.CFF; | ||
trace("// renderingMode: " + font.renderingMode); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/tests/swfs/avm2/text_engine_fontdescription/output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// FontDescription::cffHinting | ||
TypeError: Error #2007: Parameter cffHinting must be non-null. | ||
ArgumentError: Error #2008: Parameter cffHinting must be one of the accepted values. | ||
// FontDescription::fontLookup | ||
TypeError: Error #2007: Parameter fontLookup must be non-null. | ||
ArgumentError: Error #2008: Parameter fontLookup must be one of the accepted values. | ||
// FontDescription::fontName | ||
TypeError: Error #2007: Parameter fontName must be non-null. | ||
// FontDescription::fontPosture | ||
TypeError: Error #2007: Parameter fontPosture must be non-null. | ||
ArgumentError: Error #2008: Parameter fontPosture must be one of the accepted values. | ||
// FontDescription::fontWeight | ||
TypeError: Error #2007: Parameter fontWeight must be non-null. | ||
ArgumentError: Error #2008: Parameter fontWeight must be one of the accepted values. | ||
// FontDescription::renderingMode | ||
TypeError: Error #2007: Parameter renderingMode must be non-null. | ||
ArgumentError: Error #2008: Parameter renderingMode must be one of the accepted values. | ||
// cffHinting: none | ||
// cffHinting: horizontalStem | ||
// fontLookup: device | ||
// fontLookup: embeddedCFF | ||
// fontPosture: normal | ||
// fontPosture: italic | ||
// fontWeight: normal | ||
// fontWeight: bold | ||
// renderingMode: normal | ||
// renderingMode: cff |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_frames = 1 |