简体   繁体   English

火花标签中的小文字看起来很膨胀

[英]Small text in spark label looks bloor

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. 在使用spark标签之前,我使用mx标签,并且小尺寸(textSize:11)的文本看起来清晰。 After change component on spark label, text looks blurry, not soo clear. 更换火花标签上的组件后,文本看起来模糊不清。 Im embed font from my system. 我从系统中嵌入了字体。 Font name is Tahoma. 字体名称是Tahoma。 Changing values like cffHinting dont give me any result. 像cffHinting这样的值更改不会给我任何结果。 I'm use flashDevelop, but same result in IDEA and FlashBuilder. 我使用的是flashDevelop,但在IDEA和FlashBuilder中的结果相同。 I cant post screenShot bicouse of my small reputation level. 我无法发布我的小声誉级别的screenShot bicouse。 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: 以及来自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. 我认为模糊效果和大小标签文本更改是因为您的Flex编译器无法找到指定的字体,因此它使用默认字体。

1 - use local() to locate local font like this : 1-使用local()查找本地字体,如下所示:

   @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 : 2-在src /文件夹中创建一个flex配置文件local-font-config.xml并指定您的字体路径:

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

-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 ...我认为使用字体的最佳方法是将其用作项目资源,因此避免了其他配置只需在项目中创建src / assets / fonts文件夹并放入字体

and in your css file just do this : 并在您的css文件中执行以下操作:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM