mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-07-26 18:00:38 +00:00
feat: font loading and dumping (#866)
* feat: font loading and dumping * chore: make font properties unsigned if possible * chore: use merge_patch to dump json font * chore: font material is required * chore: move static methods from font loader and dumper to anonymous namespace * chore: make sure loaded fonts have their glyphs sorted * chore: add macros for json NLOHMANN_TO_JSON_METHOD and NLOHMANN_FROM_JSON_METHOD * feat: encode printable letters as string in json Co-authored-by: hindercanrun <[email protected]> * chore: omit redundant glyph count from jsons --------- Co-authored-by: Jan Laupetin <[email protected]> Co-authored-by: hindercanrun <[email protected]> Co-authored-by: MrIkso <[email protected]>
This commit is contained in:
co-authored by
Jan Laupetin
hindercanrun
MrIkso
parent
fb4b00398c
commit
3fb8b2bb17
@@ -53,17 +53,21 @@ namespace nlohmann
|
||||
}
|
||||
} // namespace nlohmann
|
||||
|
||||
#define NLOHMANN_TO_JSON_METHOD(Type) \
|
||||
template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
|
||||
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t)
|
||||
|
||||
#define NLOHMANN_FROM_JSON_METHOD(Type) \
|
||||
template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
|
||||
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t)
|
||||
|
||||
#define EXTEND_JSON_TO(v1) extended_to_json(#v1, nlohmann_json_j, nlohmann_json_t.v1);
|
||||
#define EXTEND_JSON_FROM(v1) extended_from_json(#v1, nlohmann_json_j, nlohmann_json_t.v1);
|
||||
|
||||
#define NLOHMANN_DEFINE_TYPE_EXTENSION(Type, ...) \
|
||||
template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
|
||||
inline void to_json(BasicJsonType& nlohmann_json_j, const Type& nlohmann_json_t) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(EXTEND_JSON_TO, __VA_ARGS__)) \
|
||||
} \
|
||||
template<typename BasicJsonType, nlohmann::detail::enable_if_t<nlohmann::detail::is_basic_json<BasicJsonType>::value, int> = 0> \
|
||||
inline void from_json(const BasicJsonType& nlohmann_json_j, Type& nlohmann_json_t) \
|
||||
NLOHMANN_TO_JSON_METHOD(Type){NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(EXTEND_JSON_TO, __VA_ARGS__))} \
|
||||
\
|
||||
NLOHMANN_FROM_JSON_METHOD(Type) \
|
||||
{ \
|
||||
NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(EXTEND_JSON_FROM, __VA_ARGS__)) \
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user