-
-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text Field fails to render certain Unicode characters #2669
Comments
I wonder if the Arial font actually includes the |
The looped square char (U+2318) is not included with Arial. Chrome for instance falls back to the Cambria Math font which includes it. |
As far as I know, OpenFL's Interestingly, Flash Player and AIR on macOS (just a quick test... I didn't try on Windows or Linux) can render the |
https://www.fileformat.info/info/unicode/char/2318/fontsupport.htm var textString = '....';// your text here
var tf = new TextField( 100, 100 );
addChild(tf);
var beginArial = '<FONT FACE="Arial" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">';
var beginCambria = '<FONT FACE="Cambria" SIZE="12" COLOR="#000000" LETTERSPACING="0" KERNING="0">';
tf.htmlText = beginArial + textString.split('⌘').join( '<\FONT>' + beginCambria + '⌘' + '<\FONT>' + beginArial ) + </FONT>; another way is with CSS styles setup in code either by trying to reference them in the flash html. tf.defaultTextFormat = arialTextFormat;
var arr = [];
var i = 0;
while(true) {
// becareful of infinite loops should be ok but put a max iter in there on first run.
var j = textString.indexOf('⌘',0);
if( j == -1 ){
break;
} else {
arr.push( j );
i = j +1;
}
}
for( i in 0...arr.length ){
tf.setTextFormat( cambriaTextFormat, arr[i], arr[i+1] );
} Not tried any of this recently and not sure I even have any of my as3 textmangling still to hand and unsure how well will work on openfl but you will need to embed required font/chars. |
signed distance field fonts would allow you to use images with characters you want without trying to hack a char into an existing TTF. Ceramic uses SDF by default I think. |
Scanline provided the information I needed; here is the same sample on Windows, but using the Inconsolata font. |
Describe the bug
Rendering with OpenFL simply displays a blank space when attempting to display the character
⌘
.The issue occurs on Windows and MacOS but not HTML5.
To Reproduce
Expected behavior
I would expect the Unicode to display correctly.
Screenshots
Windows example:
HTML5 example:
Additional context
OpenFL
9.2.2
Use case: Creating a user interface for use specifically on Mac, which uses dedicated symbols for its keybinds.
The text was updated successfully, but these errors were encountered: