mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 1280162 - patch 2 - Add a getFeatures() method to InspectorFontFace to expose the OpenType features supported by a font. r=dholbert,bz
This commit is contained in:
parent
8ddd714a33
commit
3b1dc9e5ec
@ -111,6 +111,12 @@ dictionary InspectorVariationInstance {
|
||||
required sequence<InspectorVariationValue> values;
|
||||
};
|
||||
|
||||
dictionary InspectorFontFeature {
|
||||
required DOMString tag;
|
||||
required DOMString script;
|
||||
required DOMString languageSystem;
|
||||
};
|
||||
|
||||
[ChromeOnly]
|
||||
interface InspectorFontFace {
|
||||
// An indication of how we found this font during font-matching.
|
||||
@ -127,6 +133,7 @@ interface InspectorFontFace {
|
||||
|
||||
[NewObject,Throws] sequence<InspectorVariationAxis> getVariationAxes();
|
||||
[NewObject,Throws] sequence<InspectorVariationInstance> getVariationInstances();
|
||||
[NewObject,Throws] sequence<InspectorFontFeature> getFeatures();
|
||||
|
||||
// meaningful only when the font is a user font defined using @font-face
|
||||
readonly attribute CSSFontFaceRule? rule; // null if no associated @font-face rule
|
||||
|
@ -259,5 +259,26 @@ InspectorFontFace::GetVariationInstances(
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InspectorFontFace::GetFeatures(nsTArray<InspectorFontFeature>& aResult,
|
||||
ErrorResult& aRV)
|
||||
{
|
||||
AutoTArray<gfxFontFeatureInfo,64> features;
|
||||
mFontEntry->GetFeatureInfo(features);
|
||||
if (features.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
if (!aResult.SetCapacity(features.Length(), mozilla::fallible)) {
|
||||
aRV.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
for (auto& f : features) {
|
||||
InspectorFontFeature& feat = *aResult.AppendElement();
|
||||
AppendTagAsASCII(feat.mTag, f.mTag);
|
||||
AppendTagAsASCII(feat.mScript, f.mScript);
|
||||
AppendTagAsASCII(feat.mLanguageSystem, f.mLangSys);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -59,6 +59,8 @@ public:
|
||||
ErrorResult& aRV);
|
||||
void GetVariationInstances(nsTArray<InspectorVariationInstance>& aResult,
|
||||
ErrorResult& aRV);
|
||||
void GetFeatures(nsTArray<InspectorFontFeature>& aResult,
|
||||
ErrorResult& aRV);
|
||||
|
||||
bool WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto,
|
||||
|
Loading…
Reference in New Issue
Block a user