In Flash Player 10, there are two different ways to embed fonts: DefineFont3 and DefineFont4 (also known as CFF). The original Flash TextField can only be used with DefineFont3 fonts. The new Vellum components can only be used with DefineFont4.
Since Halo components use UITextField, a subclass of TextField, they are currently only compatible with DefineFont3. The Gumbo components use Vellum, so they will only be compatible with DefineFont4. Since many Flex 4 projects will use a mix of Halo and Gumbo components, this would lead to two problems:
Originally, we had planned to make a drop-in replacement for UITextField called UITLFTextField which would be compatible with DefineFont4. In this plan, the Halo components would automatically use UITLFTextField by default, but would switch back to UITextField if the developer set a compiler switch that would set the default font embedding to DefineFont3. (See the original Font Embedding proposal.)
Unfortunately, UITLFTextField won't reach feature parity with UITextField in the Flex 4.0 timeframe; in particular, it won't support editing and selection. As a result, not all Halo components will be compatible with DefineFont4. Therefore, we need to revisit our original decision. (In a near-future version, the problem should become less severe, because we'll either be able to bring UITLFTextField to parity with UITextField, or because we'll have Spark alternatives for all the Halo components that require UITextField.)
Additionally, we seem to have taken a step backwards with the usability of embedded fonts in Flex 4, in that an extra "fontLookup" attribute now needs to be specified on components that want to use DefineFont4 fonts. We should eliminate this if possible.
To accept the proposal below.
The ramifications of this proposal are as follows.
In order to manually embed a DefineFont3 font, the developer will need to:
Here are some examples:
For a Halo TextInput: (normally we would recommend you use the Spark version, but as an example…)
@font-face {
src: url("assets/ARIAL.TTF");
fontFamily: ArialDF3Embed; /* named this way so you could use ArialEmbed for the DF4 version, if needed */
cff: false;
}
mx|TextInput {
fontFamily: ArialDF3Embed;
}
For a Halo editable ComboBox, it's a bit more work since you also have to set the font on the internal TextInput:
@font-face {
src: url("assets/ARIAL.TTF");
fontFamily: ArialDF3Embed; /* named this way so you could use ArialEmbed for the DF4 version, if needed */
cff: false;
}
mx|ComboBox {
fontFamily: ArialDF3Embed;
textInputStyleName: myTextInput;
}
.myTextInput {
fontFamily: ArialDF3Embed;
}
(Note that without the fontLookup fix described in the proposal, you would need to also set "fontLookup: device" on these components, even though this is an embedded font, not a device font. That kind of confusion is why we want to make it so developers don't need to set fontLookup.)
As above.
Analysis of which Halo components are likely to be needed in a Spark app (i.e. there's no viable Spark replacement) that will require UITextField (and thus DF3)
| [[ quote ]] The following analysis covers all Halo components in the Flex SDK that display text. It doesn't include any DMV stuff, but I don't think the DMV components will change the conclusion. UITLFTextField (completed through Milestone 1) can be the default in the following Halo components, which simply display single-format, non-interactive text: Accordion Alert Button ButtonBar CheckBox DateChooser FileSystemComboBox FileSystemHistoryButton FormHeading FormItem LinkBar LinkButton Menu MenuBar Panel PopUpButton PopUpMenuButton PrintDataGrid ProgressBar RadioButton TabBar TabNavigator TitleWindow ToggleButtonBar ToolTip The remaining components support interactive text (i.e, text that is scrollable, selectable, editable, or has hyperlinks) or rich text. We cannot make UITLFTextField the default for them without doing significant additional work (Milestones 2 and/or 3) in UITLFTextField; they must continue to use TextField or else they will throw RTEs. So the question for Flex 4 is whether they present a problem by having common use cases that require embedded fonts to use DF3. List-based components (List, FileSystemList, HorizontalList, TileList,, DataGrid, FileSystemDataGrid, Tree, FileSystemTree): Some of these (List, HorizontalList, TileList) have Spark replacements. Or, in the common case that developers don't use editability or htmlText-based custom item renderers, they can opt in to use UITLFTextFIeld in order to use DF4. Otherwise, they would need DF3. Label, Text: Developers can use Spark replacements. Or, in the common case that developers don't use htmlText, they can opt in to use UITLFTextField in order to use DF4. Otherwise, they would need DF3. TextInput, TextArea: Developers can use Spark replacements. Otherwise, they would need DF3. RichTextEditor: Developers can build a Spark replacement. (We should blog an example.) Otherwise, they would need DF3. ColorPicker: This has editable text. But it only displays a color value like "#FF0000" so using an embedded font should not be necessary. If it is, they would need DF3. ComboBox: Developers can use a Spark ComboBox. Or, in the common case that it doesn't need to be editable, they can opt in to use UITLFTextField in order to use DF4. Otherwise, they would need DF3. DateField: In the common case that developers don't use editability, they can opt in to use UITLFTextField in order to use DF4. Otherwise, they would need DF3. NumericStepper: In the common case that it doesn't need to be editable, developers can opt in to use UITLFTextField in order to use DF4. Otherwise, they would need DF3. I conclude that the cases requiring DF3 are of the "20% of 20%" types, such as apps that use both embedded fonts and editable item renderers. We can get away with making this small fraction embed both DF3 and DF4 until TLFTextField is complete in Flex 4.1. [[ /quote ]] |