2015-04-21 43 views
2

我花了几天的时间找到解决方案来解决这个问题。在使用火花标签之前,我使用mx标签,并且尺寸较小的文本(textSize:11)看起来很清晰。在更改火花标签上的组件后,文本看起来模糊不清,不太明显。 Im从我的系统中嵌入字体。字体名称是Tahoma。改变像cffHinting这样的值不会给我任何结果。我使用flashDevelop,但在IDEA和FlashBuilder中使用相同的结果。我不能发布我的小名声级别的screenShot bicouse。帮助我请找到正确的解决方案。火花标签中的小文字看起来很bloer

@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; 
} 

和代码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> 

回答

0

我认为模糊效果和尺寸标注文本变化是因为你的Flex编译器无法找到指定的字体,所以它使用默认字体。

1 - 使用本地()来查找本地字体是这样的:

@font-face { 
     src: local("Tahoma"); 
     fontFamily: "TahomaS"; 
     embedAsCFF: true; 
    } 

    s|Label { 
     fontFamily: "TahomaS"; 
     fontSize: 44; 
    } 

2 - 创建一个Flex配置文件本地字体-config.xml中在你的src /文件夹,然后指定你的字体路径:

<?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-给你的Flex编译器的位置,你的配置文件:

-load-config+=local-font-config.xml 

...我认为,使用字体的最好的办法就是把它作为一个项目资源,让您避免额外的配置 只需创建一个的src /资产/字体在你的项目文件夹,并把你的字体

,并在你的CSS文件只是这样做:

@font-face { 
     src:url("assets/fonts/Tahoma.ttf"); 
     fontFamily: "TahomaS"; 
     embedAsCFF: true; 
    } 

    s|Label { 
     fontFamily: "TahomaS"; 
     fontSize: 44; 
    } 
+0

非常感谢你@Jileni Bouguima你的答案! “...我认为使用字体的最佳方式是将其用作项目资源,因此您可以避免其他配置只需在项目中创建一个src/assets/fonts文件夹,然后放入字体 和你的CSS文件“---是的,我使用项目资源中的字体。 我认为我对问题目标的解释是低信息量的。所有字体完美加载,我可以像我需要使用它。但是,我使用**小文本大小**,并且只能从14px和更低的**火花标签**中的字符视图看起来模糊。 –

+0

尝试使用:fontLookup =“embeddedCFF”和renderingMode =“cff”,如果这样不能改善文字的渲染效果,则会更改另一种字体。火花标签使用FTE(Flash文本引擎)新的文本引擎更强大的TextField类使用的MX标签 –

+0

nope,改变fontLookup和renderMode不给任何效果...我的事情我只是尝试找到另一种字体,与类似的Tahoma字体视图。 Thant你的帮助:) –