Flex - Flash Builder 设计视图未正确显示嵌入字体
工具:Air 2、Flex SDK 4.1、Flash Builder、Halo 组件集(根本没有使用 Spark)
字体在运行应用程序时完美运行,但在设计视图中则不然。这实际上使设计视图变得无价值,因为在不知道真实大小的情况下不可能正确定位组件或标签(它会根据字体而变化......)
...
根组件中包含 CSS,如下所示:
<fx:Style source="style.css"/>
CSS 文件:
/* CSS file */
@namespace mx "library://ns.adobe.com/flex/mx";
global {
font-family:Segoe;
font-size:14;
color:#FFFFFF;
}
mx|Application, mx|VBox, mx|HBox, mx|Canvas {
font-family:Segoe;
background-color:#660000;
border-color:#222277;
color:#FFFFFF;
}
mx|Button {
font-family:Segoe;
fill-colors:#660000, #660000, #660000, #660000;
color:#FFFFFF;
}
...
有趣的是(或者有问题?),当我尝试将样式标签粘贴到子组件(低于顶级容器)时,我在子组件编辑器视图中收到一堆警告,指出不支持 CSS 类型选择器。 .(样式表中的所有组件)。
然而,当应用程序执行时,它们确实起作用。啊?
这就是我将字体嵌入到 root 级别容器中的方式:
[Embed(source="/assets/segoepr.ttf", fontName="Segoe", mimeType="application/x-font-truetype", embedAsCFF='false')]
public static const font:Class;
[Embed(source="/assets/segoeprb.ttf", fontName="Segoe", mimeType="application/x-font-truetype", fontWeight="bold", embedAsCFF='false')]
public static const font2:Class;
那么,有没有办法让嵌入的字体在设计视图中工作或者什么?
Tools: Air 2, Flex SDK 4.1, Flash Builder, Halo component set (NO Spark being used at all)
Fonts work perfectly when running the appliction, but not in design view. This effectively makes design view WORTHLESS because it's impossible to properly position components or labels without knowing what the true size is (it changes depending on font...)
...
CSS included in root component like so:
<fx:Style source="style.css"/>
CSS file:
/* CSS file */
@namespace mx "library://ns.adobe.com/flex/mx";
global {
font-family:Segoe;
font-size:14;
color:#FFFFFF;
}
mx|Application, mx|VBox, mx|HBox, mx|Canvas {
font-family:Segoe;
background-color:#660000;
border-color:#222277;
color:#FFFFFF;
}
mx|Button {
font-family:Segoe;
fill-colors:#660000, #660000, #660000, #660000;
color:#FFFFFF;
}
...
Interestingly (or buggily?), when I try pasting the style tag into a subcomponent (lower than the top level container), I get a bunch of warnings in the subcomponent editor view stating that CSS type selectors are not supported in.. (all the components in the style sheet).
Yet, they do work when the application is executed. Huh?
This is how I'm embedding the fonts in the root level container:
[Embed(source="/assets/segoepr.ttf", fontName="Segoe", mimeType="application/x-font-truetype", embedAsCFF='false')]
public static const font:Class;
[Embed(source="/assets/segoeprb.ttf", fontName="Segoe", mimeType="application/x-font-truetype", fontWeight="bold", embedAsCFF='false')]
public static const font2:Class;
So, is there a way to get embedded fonts to work in design view or what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道这是否有帮助,但值得一试。如果您使用的是 css,则无需使用 Embed Meta 标签嵌入字体。尝试删除字体类嵌入并在 css 文件中添加嵌入。这可能与 Flex 中的设计视图配合得更好。
在设计视图中尝试以下代码:
I dont know if this helps but it is worth a shot. You don´t need to embed the fonts with the Embed Meta tag if you are using css. Try removing the font class embedding and add the embedding in the css file. This may work better with the design view in Flex.
Try this code in design view:
默认情况下,标签和文本区域似乎需要使用
Verdana
字体,如果我们不嵌入它,则设计视图不会考虑任何其他嵌入字体。请嵌入
Verdana
字体,您应该能够在设计视图中看到标签和文本区域。希望这有帮助。
It seems that the font
Verdana
is expected for Label and Text areas by default and if we do not embed it, the design view does not take any other embedded fonts in consideration.Please embed the
Verdana
font and you should be able to see the labels and text areas in design view.Hope this helps.