/** Gets a BCP 47 language identifier for this SkLanguage. @returnaBCP47languageidentifierrepresentingthislanguage
*/ const SkString& getTag() const { return fTag; }
/** Performs BCP 47 fallback to return an SkLanguage one step more general. @returnanSkLanguageonestepmoregeneral
*/
SkLanguage getParent() const;
booloperator==(const SkLanguage& b) const { return fTag == b.fTag;
} booloperator!=(const SkLanguage& b) const { return fTag != b.fTag;
}
private: //! BCP 47 language identifier
SkString fTag;
};
skia_private::TArray<SkString, true> fNames;
skia_private::TArray<FontFileInfo, true> fFonts;
skia_private::TArray<SkLanguage, true> fLanguages;
skia_private::THashMap<SkString, std::unique_ptr<FontFamily>> fallbackFamilies;
FontVariant fVariant; int fOrder; // internal to the parser, not useful to users. bool fIsFallbackFont;
SkString fFallbackFor; const SkString fBasePath;
};
namespace SkFontMgr_Android_Parser {
/** Parses system font configuration files and appends result to fontFamilies. */ void GetSystemFontFamilies(std::vector<std::unique_ptr<FontFamily>>& fontFamilies);
/** Parses font configuration files and appends result to fontFamilies. */ void GetCustomFontFamilies(std::vector<std::unique_ptr<FontFamily>>& fontFamilies, const SkString& basePath, constchar* fontsXml, constchar* fallbackFontsXml, constchar* langFallbackFontsDir = nullptr);
} // namespace SkFontMgr_Android_Parser
/** Parses a null terminated string into an integer type, checking for overflow. *http://www.w3.org/TR/html-markup/datatypes.html#common.data.integer.non-negative-def * *Ifthestringcannotbeparsedinto'value',returnsfalseanddoesnotchange'value'.
*/ template <typename T> bool parse_non_negative_integer(constchar* s, T* value) {
static_assert(std::numeric_limits<T>::is_integer, "T_must_be_integer");
if (*s == '\0') { returnfalse;
}
const T nMax = std::numeric_limits<T>::max() / 10; const T dMax = std::numeric_limits<T>::max() - (nMax * 10);
T n = 0; for (; *s; ++s) { // Check if digit if (*s < '0' || '9' < *s) { returnfalse;
}
T d = *s - '0'; // Check for overflow if (n > nMax || (n == nMax && d > dMax)) { returnfalse;
}
n = (n * 10) + d;
}
*value = n; return true;
}
/** Parses a null terminated string into a signed fixed point value with bias N. * *Likehttp://www.w3.org/TR/html-markup/datatypes.html#common.data.float-def , *butmaystartwith'.'anddoesnotsupport'e'.'-?((:digit:+(.:digit:+)?)|(.:digit:+))' * *Checksforoverflow. *Lowbitroundingisnotdefined(iscurrentlytruncate). *Bias(N)requiredtoallowforthesignbitand4bitsofinteger. * *Ifthestringcannotbeparsedinto'value',returnsfalseanddoesnotchange'value'.
*/ template <int N, typename T> bool parse_fixed(constchar* s, T* value) {
static_assert(std::numeric_limits<T>::is_integer, "T_must_be_integer");
static_assert(std::numeric_limits<T>::is_signed, "T_must_be_signed");
static_assert(sizeof(T) * CHAR_BIT - N >= 5, "N_must_leave_four_bits_plus_sign");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.