I've defined a Russian localization file but when setting the locale all I get is ? symbols...
When creating a sample flex app with Cyrillic characters they are displayed just fine, but somehow setting the locale does no work.
Any ideas?
Fixed it...
My localization files were not encoded in UTF8, that was causing the problem.
It sounds like you're using embedded fonts, but the characters you're trying to display aren't included in the font.
From the docs:
<?xml version="1.0"?>
<!-- fonts/EmbeddedFontCharacterRange.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
#font-face {
src:url("../assets/MyriadWebPro.ttf");
fontFamily: myFontFamily;
advancedAntiAliasing: true;
unicodeRange:
U+0041-U+005A, /* Upper-Case [A..Z] */
U+0061-U+007A, /* Lower-Case a-z */
U+0030-U+0039, /* Numbers [0..9] */
U+002E-U+002E; /* Period [.] */
}
TextArea {
fontFamily: myFontFamily;
fontSize: 32;
}
Related
I spent a few days to find solution to solve this problem. Before using spark label, im use mx label, and text with small size (textSize:11) looks clear. After change component on spark label, text looks blurry, not soo clear. Im embed font from my system. Font name is Tahoma. Changing values like cffHinting dont give me any result. I'm use flashDevelop, but same result in IDEA and FlashBuilder. I cant post screenShot bicouse of my small reputation level. Help me please find right solution.
#namespace s "library://ns.adobe.com/flex/spark";
#namespace mx "library://ns.adobe.com/flex/mx";
#font-face{
src:url("Tahoma.ttf");
font-family:TahomaS;
embedAsCFF: true;
}
#font-face{
src:url("Tahoma.ttf");
font-family:TahomaMX;
embedAsCFF: false;
}
s|Label
{
font-family:TahomaS;
font-size:11;
color: #5c5c5c;
}
mx|Label
{
font-family:TahomaMX;
font-size:11;
color: #5c5c5c;
}
And code from Main.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Style source="Fonts.css"/>
<s:Label x="50" y="50" text="XYZ Corporation Directory" cffHinting="none" />
<mx:Label x="50" y="65" text="XYZ Corporation Directory" />
</s:Application>
I think that blurry effect and size label text change is because that your flex compiler can't locate the specified font, so it use the default font.
1 - use local() to locate local font like this :
#font-face {
src: local("Tahoma");
fontFamily: "TahomaS";
embedAsCFF: true;
}
s|Label {
fontFamily: "TahomaS";
fontSize: 44;
}
2 - create a flex config file local-font-config.xml in your src/ folder and specify your font path :
<?xml version="1.0" encoding="utf-8"?>
<flex-config>
<compiler>
<fonts>
<local-font-paths>
<path-element>/System/Library/Fonts/</path-element>
</local-font-paths>
</fonts>
</compiler>
</flex-config>
3- give to your flex compiler the location of your config file :
-load-config+=local-font-config.xml
... i think that the best way to use fonts is to use it as a project resources, so you avoid additional configurations
Just create an src/assets/fonts folder in your project and put in your fonts
and in your css file just do this :
#font-face {
src:url("assets/fonts/Tahoma.ttf");
fontFamily: "TahomaS";
embedAsCFF: true;
}
s|Label {
fontFamily: "TahomaS";
fontSize: 44;
}
I try to apply support for RTL interfaces(locales) in the options
window of an extension for firefox.
So far, i have tried the following, without success:
In my options.xul (simplified code):
<hbox>
<image id="myImage"/><!-- or image class="myImage" -->
</hbox>
In my css (simplified code):
#myImage:-moz-locale-dir(ltr) { /* or .myImage:-moz-locale-dir(ltr) */
list-style-image: url(chrome://path/image1.png);
}
#myImage:-moz-locale-dir(rtl) { /* or .myImage:-moz-locale-dir(rtl) */
list-style-image: url(chrome://path/image2.png);
}
My interface loads always the image1. For my tests on RTL
direction, i have installed some real RTL locales, like Hebrew
and the "Force RTL" extension. Any idea why the above does not work?
In RTL mode, if i remove the first css entry, the pseudoclass -moz-locale-dir(rtl) does not match, resulting in no image..
I'm having a hard time trying to limit the size of the app by reducing the unicode range of my fonts.
I've tried several different combinations, the error is the same no matter what range I put there:
-invalid Unicode range '005A'
Where 005A can be anything, if I do this:
unicodeRange: U+0020-007E;
The error is this: -invalid Unicode range '007E'
I've tried different fonts, Arial, Helvetica, Century... Same error in everyone, all the unicode ranges throw errors in the CSS file.
Any ideas what could be wrong? I've read the documentation from Adobe, not sure what else to do.
Here is a CSS file as example - it works well for me in an iOS/Android card game app (where I need card suits and cyrillic characters):
#namespace s "library://ns.adobe.com/flex/spark";
#namespace mx "library://ns.adobe.com/flex/mx";
#font-face {
src: url("/assets/fonts/arial.ttf");
fontFamily: embFont;
embedAsCFF: false; /* required for StyleableTextField */
unicodeRange:
U+0020-U+0040, /* Punctuation, Numbers */
U+2660-U+2666, /* Card suits */
U+0041-U+005A, /* Upper-Case A-Z */
U+0061-U+007A, /* Lower-Case a-z */
U+0410-U+0451; /* Cyrillic */
}
s|LabelItemRenderer {
fontFamily: embFont;
}
I've tested this snippet with 3 different TTF fonts and I still din't get #font-face working within Flex. Am I missing something here?
Tried both absolute and relative paths on url(), no changes. If I use any standard font (Arial, Verdana, Tahoma...), the Hello World! text appears, but when I try to use any external font, nothing shows.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%">
<mx:Style>
#font-face {
src: url(josefin-sans.ttf);
fontFamily: JosefinSans;
}
.custom {
fontFamily: JosefinSans;
fontSize: 36pt;
}
</mx:Style>
<mx:Text id="text" styleName="custom" text="Hello World!" />
Compiled with:
mxmlc -static-link-runtime-shared-libraries=true flex.mxml
As you are using MX components, you should embed fonts with embedAsCFF: false; flag.
#font-face
{
src: url("josefin-sans.ttf");
fontFamily: "JosefinSans";
fontWeight: normal;
embedAsCFF: false;
}
If it doesn't work, launch the application in debug mode and watch for errors. Also, be sure that the font you are using can be displayed with bold and italic if needed.
The following #font-face declaration works perfectly well on Firefox (Mac) but not Safari/WebKit:
#font-face {
font-family:MyGaramond;
src:local("Garamond Premier Pro"), /* Full name */
local("GaramondPremrPro"), /* Postscript name */
url("GaramondPremrPro.otf") format("opentype"); /* Fallback */
}
h2 {
font-family:MyGaramond, sans-serif !important;
}
To clarify, I've also tried:
#font-face {
font-family:MyGaramond;
src:local("Garamond Premier Pro"), /* Full name */
local("GaramondPremrPro"), /* Postscript name */
url("GaramondPremrPro.otf"); /* Fallback */
}
h2 {
font-family:MyGaramond, sans-serif !important;
}
, with/without quotes, etc.
Has anyone else experienced this, and if so, how did you fix it? That this isn't working is really baffling (and a tad irritating...).
I think webkit still has some problems with opentype. How does opera handle it?
I always use the #font-face Generator from font squirrel, never had any browser issues that way.
Check the site: http://www.fontsquirrel.com/fontface/generator