Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support font-style in geckolib #11240

Merged
merged 1 commit into from
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/style/properties/longhand/font.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</%helpers:longhand>


${helpers.single_keyword("font-style", "normal italic oblique")}
${helpers.single_keyword("font-style", "normal italic oblique", gecko_constant_prefix="NS_FONT_STYLE")}
${helpers.single_keyword("font-variant", "normal small-caps")}

<%helpers:longhand name="font-weight" need_clone="True">
Expand Down
131 changes: 131 additions & 0 deletions ports/geckolib/gecko_bindings/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,44 @@ pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3;
pub const NS_FONT_STYLE_NORMAL: ::std::os::raw::c_uint = 0;
pub const NS_FONT_STYLE_ITALIC: ::std::os::raw::c_uint = 1;
pub const NS_FONT_STYLE_OBLIQUE: ::std::os::raw::c_uint = 2;
pub const NS_FONT_WEIGHT_NORMAL: ::std::os::raw::c_uint = 400;
pub const NS_FONT_WEIGHT_BOLD: ::std::os::raw::c_uint = 700;
pub const NS_FONT_WEIGHT_THIN: ::std::os::raw::c_uint = 100;
pub const NS_FONT_STRETCH_NORMAL: ::std::os::raw::c_uint = 0;
pub const NS_FONT_STRETCH_SEMI_EXPANDED: ::std::os::raw::c_uint = 1;
pub const NS_FONT_STRETCH_EXPANDED: ::std::os::raw::c_uint = 2;
pub const NS_FONT_STRETCH_EXTRA_EXPANDED: ::std::os::raw::c_uint = 3;
pub const NS_FONT_STRETCH_ULTRA_EXPANDED: ::std::os::raw::c_uint = 4;
pub const NS_FONT_SMOOTHING_AUTO: ::std::os::raw::c_uint = 0;
pub const NS_FONT_SMOOTHING_GRAYSCALE: ::std::os::raw::c_uint = 1;
pub const NS_FONT_KERNING_AUTO: ::std::os::raw::c_uint = 0;
pub const NS_FONT_KERNING_NONE: ::std::os::raw::c_uint = 1;
pub const NS_FONT_KERNING_NORMAL: ::std::os::raw::c_uint = 2;
pub const NS_FONT_SYNTHESIS_WEIGHT: ::std::os::raw::c_uint = 1;
pub const NS_FONT_SYNTHESIS_STYLE: ::std::os::raw::c_uint = 2;
pub const NS_FONT_DISPLAY_AUTO: ::std::os::raw::c_uint = 0;
pub const NS_FONT_DISPLAY_BLOCK: ::std::os::raw::c_uint = 1;
pub const NS_FONT_DISPLAY_SWAP: ::std::os::raw::c_uint = 2;
pub const NS_FONT_DISPLAY_FALLBACK: ::std::os::raw::c_uint = 3;
pub const NS_FONT_DISPLAY_OPTIONAL: ::std::os::raw::c_uint = 4;
pub const NS_FONT_VARIANT_CAPS_NORMAL: ::std::os::raw::c_uint = 0;
pub const NS_FONT_VARIANT_CAPS_SMALLCAPS: ::std::os::raw::c_uint = 1;
pub const NS_FONT_VARIANT_CAPS_ALLSMALL: ::std::os::raw::c_uint = 2;
pub const NS_FONT_VARIANT_CAPS_PETITECAPS: ::std::os::raw::c_uint = 3;
pub const NS_FONT_VARIANT_CAPS_ALLPETITE: ::std::os::raw::c_uint = 4;
pub const NS_FONT_VARIANT_CAPS_TITLING: ::std::os::raw::c_uint = 5;
pub const NS_FONT_VARIANT_CAPS_UNICASE: ::std::os::raw::c_uint = 6;
pub const NS_FONT_VARIANT_POSITION_NORMAL: ::std::os::raw::c_uint = 0;
pub const NS_FONT_VARIANT_POSITION_SUPER: ::std::os::raw::c_uint = 1;
pub const NS_FONT_VARIANT_POSITION_SUB: ::std::os::raw::c_uint = 2;
pub const NS_FONT_VARIANT_WIDTH_NORMAL: ::std::os::raw::c_uint = 0;
pub const NS_FONT_VARIANT_WIDTH_FULL: ::std::os::raw::c_uint = 1;
pub const NS_FONT_VARIANT_WIDTH_HALF: ::std::os::raw::c_uint = 2;
pub const NS_FONT_VARIANT_WIDTH_THIRD: ::std::os::raw::c_uint = 3;
pub const NS_FONT_VARIANT_WIDTH_QUARTER: ::std::os::raw::c_uint = 4;
pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215;
pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint =
16777216;
Expand Down Expand Up @@ -4178,6 +4216,99 @@ pub struct ArenaRefPtr<T> {
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum gfxFontConstants_h_unnamed_10 {
eFeatureAlternates_historical = 0,
eFeatureAlternates_stylistic = 1,
eFeatureAlternates_styleset = 2,
eFeatureAlternates_character_variant = 3,
eFeatureAlternates_swash = 4,
eFeatureAlternates_ornaments = 5,
eFeatureAlternates_annotation = 6,
eFeatureAlternates_numFeatures = 7,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum gfxFontConstants_h_unnamed_11 {
eFeatureEastAsian_jis78 = 0,
eFeatureEastAsian_jis83 = 1,
eFeatureEastAsian_jis90 = 2,
eFeatureEastAsian_jis04 = 3,
eFeatureEastAsian_simplified = 4,
eFeatureEastAsian_traditional = 5,
eFeatureEastAsian_full_width = 6,
eFeatureEastAsian_prop_width = 7,
eFeatureEastAsian_ruby = 8,
eFeatureEastAsian_numFeatures = 9,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum gfxFontConstants_h_unnamed_12 {
eFeatureLigatures_none = 0,
eFeatureLigatures_common = 1,
eFeatureLigatures_no_common = 2,
eFeatureLigatures_discretionary = 3,
eFeatureLigatures_no_discretionary = 4,
eFeatureLigatures_historical = 5,
eFeatureLigatures_no_historical = 6,
eFeatureLigatures_contextual = 7,
eFeatureLigatures_no_contextual = 8,
eFeatureLigatures_numFeatures = 9,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum gfxFontConstants_h_unnamed_13 {
eFeatureNumeric_lining = 0,
eFeatureNumeric_oldstyle = 1,
eFeatureNumeric_proportional = 2,
eFeatureNumeric_tabular = 3,
eFeatureNumeric_diagonal_fractions = 4,
eFeatureNumeric_stacked_fractions = 5,
eFeatureNumeric_slashedzero = 6,
eFeatureNumeric_ordinal = 7,
eFeatureNumeric_numFeatures = 8,
}
pub const eFontPrefLang_First: eFontPrefLang =
eFontPrefLang::eFontPrefLang_Western;
pub const eFontPrefLang_Last: eFontPrefLang =
eFontPrefLang::eFontPrefLang_Others;
pub const eFontPrefLang_Count: eFontPrefLang =
eFontPrefLang::eFontPrefLang_CJKSet;
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum eFontPrefLang {
eFontPrefLang_Western = 0,
eFontPrefLang_Japanese = 1,
eFontPrefLang_ChineseTW = 2,
eFontPrefLang_ChineseCN = 3,
eFontPrefLang_ChineseHK = 4,
eFontPrefLang_Korean = 5,
eFontPrefLang_Cyrillic = 6,
eFontPrefLang_Greek = 7,
eFontPrefLang_Thai = 8,
eFontPrefLang_Hebrew = 9,
eFontPrefLang_Arabic = 10,
eFontPrefLang_Devanagari = 11,
eFontPrefLang_Tamil = 12,
eFontPrefLang_Armenian = 13,
eFontPrefLang_Bengali = 14,
eFontPrefLang_Canadian = 15,
eFontPrefLang_Ethiopic = 16,
eFontPrefLang_Georgian = 17,
eFontPrefLang_Gujarati = 18,
eFontPrefLang_Gurmukhi = 19,
eFontPrefLang_Khmer = 20,
eFontPrefLang_Malayalam = 21,
eFontPrefLang_Mathematics = 22,
eFontPrefLang_Oriya = 23,
eFontPrefLang_Telugu = 24,
eFontPrefLang_Kannada = 25,
eFontPrefLang_Sinhala = 26,
eFontPrefLang_Tibetan = 27,
eFontPrefLang_Others = 28,
eFontPrefLang_CJKSet = 29,
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum LogicalAxis { eLogicalAxisBlock = 0, eLogicalAxisInline = 1, }
#[repr(u32)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
Expand Down
1 change: 1 addition & 0 deletions ports/geckolib/gecko_bindings/tools/regen_style_structs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export RUST_BACKTRACE=1
-match "nsStyleCoord.h" \
-match "RefPtr.h" \
-match "nsISupportsImpl.h" \
-match "gfxFontConstants.h" \
-match "gfxFontFamilyList.h" \
-match "gfxFontFeatures.h" \
-match "imgRequestProxy.h" \
Expand Down
6 changes: 4 additions & 2 deletions ports/geckolib/properties.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl Debug for ${style_struct.gecko_struct_name} {
# These live in nsStyleImageLayers in gecko. Need to figure out what to do about that.
force_stub += ["background-repeat", "background-attachment", "background-clip", "background-origin"];
# These live in an nsFont member in Gecko. Should be straightforward to do manually.
force_stub += ["font-kerning", "font-stretch", "font-style", "font-variant"]
force_stub += ["font-kerning", "font-stretch", "font-variant"]
# These have unusual representations in gecko.
force_stub += ["list-style-type", "text-overflow"]
# Enum class instead of NS_STYLE_...
Expand Down Expand Up @@ -589,7 +589,9 @@ fn static_assert() {
}
</%self:impl_trait>

<%self:impl_trait style_struct_name="Font" skip_longhands="font-size font-weight" skip_additionals="*">
<%self:impl_trait style_struct_name="Font" skip_longhands="font-style font-size font-weight" skip_additionals="*">
<%call expr="impl_keyword('font_style', 'mFont.style',
data.longhands_by_name['font-style'].keyword, need_clone=False)"></%call>

// FIXME(bholley): Gecko has two different sizes, one of which (mSize) is the
// actual computed size, and the other of which (mFont.size) is the 'display
Expand Down