Conversation
|
Hi ! |
81df683 to
8f5469f
Compare
|
@qnga Hey! :)
Sure! Thanks for fixing the issue.
I agree that Readium already has a good system to build font families through In our app Android XML font family resources are the source of truth. We use them across XML layouts and Compose. The app is white-label, with 100+ flavors, and each flavor can override resources such as strings, colors, font families, etc. This follows Android’s built in approach for defining font families in resources, as described here. The XML file groups the font files together with their style and weight details, and exposes them as a single font resource. Without XML font family support in Readium we need to duplicate the same font family definition in
Our app could parse these XML files itself and convert them to Readium declarations but then every app with the same need would have to implement its own parser/bridge. Since this is a standard Android resource format and maps directly to Readium’s existing This PR does not replace Readium’s font family system. It only adds a bridge from Android |
Related issue: #786
Android allows resources to be provided using either the
resorassetsfolders. Classic Android apps provide most resources, such as images, strings, and fonts, usingresmaking them easy to use in XML layouts, views, and composables.Currently, Readium allows custom fonts to be provided only through the
assetsfolder. This means apps need to store the same font in bothresandassetsto use it in XML and in Readium.This PR removes that limitation and allows the font family to be specified using either a single font file or an Android XML font family.
Summary
@font-facedeclarations.Changes
Core navigator support
readium/navigator/src/main/java/org/readium/r2/navigator/epub/resources/ResourcePaths.ktreadium/navigator/src/main/java/org/readium/r2/navigator/epub/resources/ResourceFontFamily.ktConfiguration.addFontFamilyDeclaration(...)readium/navigator/src/main/java/org/readium/r2/navigator/epub/resources/FontFamilyDeclarations.ktWebView serving updates