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

ndk: Add bindings for AFont #397

Merged
merged 53 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
65468f3
Detect OS from `generate_bindings.sh`
paxbun Jun 15, 2023
ac6aafe
Use --no-size_t-is-usize to ensure size_t is generated
paxbun Jun 15, 2023
6177f61
Prevent AFont bindgen errors by adding `typedef struct` to wrapper.h
paxbun Jun 15, 2023
564e2ec
ndk-sys: Add AFont-related bindings
paxbun Jun 15, 2023
8df886a
ndk: Add bindings for AFont
paxbun Jun 15, 2023
c6e2a08
Add bindings for AFontMatcher
paxbun Jun 15, 2023
1ef2d6b
Add bindings for ASystemFontIterator
paxbun Jun 15, 2023
6277dcc
ndk: Reflect Font-related changes to CHANGELOG
paxbun Jun 15, 2023
37a9779
ndk: Implement Display for FontWeight
paxbun Jun 15, 2023
8d5bd40
fix(ndk): Handle nullptr returning by AFont_getLocale
paxbun Jun 15, 2023
1a84524
chore(ndk): Fix some doc-comments in mod font
paxbun Jun 15, 2023
d894508
feat(ndk): Add AxisTag to mod font
paxbun Jun 15, 2023
cbaf7ce
chore(ndk): Add doc comments to FamilyVariant
paxbun Jun 15, 2023
702e16a
fix(ndk): Allow SystemFontIterator::new return optional value
paxbun Jun 15, 2023
62dbd8e
Merge branch 'master' into feat/afont
paxbun Jun 16, 2023
975f7df
fix(ndk): Remove unnecessary casts from font.rs
paxbun Jun 16, 2023
4534087
fix(ndk): Replace unwrap with expect with detailed message
paxbun Jun 16, 2023
bcf3482
Update ndk-sys/CHANGELOG.md
paxbun Jun 23, 2023
b60b8eb
Update ndk/CHANGELOG.md
paxbun Jun 23, 2023
dbc640f
Update ndk/src/font.rs
paxbun Jun 23, 2023
ce7cc84
Update derive order in ndk/src/font.rs
paxbun Jun 23, 2023
d8104f8
ndk: Link AFont to the page itself
paxbun Jun 23, 2023
a4cc283
`use std::result::Result;` in ndk/src/font.rs
paxbun Jun 23, 2023
a92c0ce
Fix documentation of ndk/src/font.rs
paxbun Jun 23, 2023
aeea686
feat(ndk): Add FontWeight::MIN
paxbun Jun 23, 2023
c9c16ed
Fix documentation of ndk/src/font.rs
paxbun Jun 23, 2023
030b3be
feat(ndk): Add owned -> owned conversions to FontWeight and AxisTag
paxbun Jun 23, 2023
ee22076
fix(ndk): Wrap the entire font module with cfg
paxbun Jun 23, 2023
e43eef1
fix(ndk): Add padding checks to AxisTag
paxbun Jun 23, 2023
ba3d2ec
feat(ndk): Add Font::from_be_bytes
paxbun Jun 23, 2023
c94f457
chore(ndk): Add an example to Font::axis_count
paxbun Jun 23, 2023
6707ec7
chore(ndk-sys): Add explanation about manual typedefs in wrapper.h
paxbun Jun 23, 2023
c8682ef
fix(ndk): Rename error types in ndk/src/font.rs
paxbun Jun 23, 2023
598223c
feat(ndk): Add detailed error messages to AxisTagValueError
paxbun Jun 23, 2023
7c875e9
Merge remote-tracking branch 'upstream/master' into feat/afont
MarijnS95 Aug 4, 2023
42d2725
feat: Add FontMatcher::match_font
paxbun Aug 5, 2023
628da8a
Fix clippy warnings
paxbun Aug 5, 2023
8b8c66f
Apply suggestions from code review
paxbun Aug 16, 2023
bd0353a
ndk: Add doc-comments to the consts in FontWeight
paxbun Aug 16, 2023
41d2bb7
ndk: Swap the content of AxisTag::from_be and from_be_bytes
paxbun Aug 16, 2023
e51ef48
ndk: Don't directly access fields of AxisTag from the outside
paxbun Aug 16, 2023
6778149
ndk: Fix doc-comments of from_ptr in ndk::font
paxbun Aug 16, 2023
0a303ee
ndk: Add AxisTag ctors that constly panics for invalid input
paxbun Aug 16, 2023
ada3c61
Remove unimplemented! from examples in ndk::font
paxbun Aug 16, 2023
1bb7c05
Remove redundant as_str logic from ndk::font
paxbun Aug 16, 2023
9a26426
ndk: Fix doc-comments in ndk::font
paxbun Aug 16, 2023
86b4ef3
Apply suggestions from code review
paxbun Aug 16, 2023
f31c36d
ndk: Fix doc-comments in ndk::font
paxbun Aug 16, 2023
c27b0a7
ndk: Makes examples in ndk::font compilable
paxbun Aug 16, 2023
4dd7c7b
Merge branch 'master' into feat/afont
paxbun Aug 16, 2023
3e1bca0
ndk: Remove trailing spaces in doc-comments in ndk::font
paxbun Aug 16, 2023
f63d238
ndk: Fix hyperlinks in doc-comments in ndk::font
paxbun Aug 16, 2023
61287c6
ndk: Fix clippy warnings in ndk::font
paxbun Aug 16, 2023
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
1 change: 1 addition & 0 deletions ndk-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

- **Breaking:** Regenerate against NDK `25.2.9519653` with `rust-bindgen 0.66.0`. (#324, #370)
- Add `font`, `font_matcher`, `system_fonts` bindings. (#397)

# 0.4.1 (2022-11-23)

Expand Down
12 changes: 11 additions & 1 deletion ndk-sys/generate_bindings.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/sh

sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/linux-x86_64/sysroot/
os=$(uname -s)

if [[ "$os" == "Darwin" ]]; then
host_tag="darwin-x86_64"
elif [[ "$os" == "CYGWIN"* ]]; then
host_tag="windows-x86_64"
else
host_tag="linux-x86_64"
fi

sysroot="${ANDROID_NDK_ROOT}"/toolchains/llvm/prebuilt/${host_tag}/sysroot/
MarijnS95 marked this conversation as resolved.
Show resolved Hide resolved
[ ! -d "$sysroot" ] && echo "Android sysroot $sysroot does not exist!" && exit 1

while read ARCH && read TARGET ; do
Expand Down
1,672 changes: 883 additions & 789 deletions ndk-sys/src/ffi_aarch64.rs

Large diffs are not rendered by default.

1,706 changes: 900 additions & 806 deletions ndk-sys/src/ffi_arm.rs

Large diffs are not rendered by default.

1,714 changes: 904 additions & 810 deletions ndk-sys/src/ffi_i686.rs

Large diffs are not rendered by default.

1,722 changes: 908 additions & 814 deletions ndk-sys/src/ffi_x86_64.rs

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions ndk-sys/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@
#include <android/dlext.h>
#include <android/fdsan.h>
#include <android/file_descriptor_jni.h>
// #include <android/font.h>
// #include <android/font_matcher.h>
// <android/font.h> is broken without the following typedef in C
typedef struct AFont AFont;
MarijnS95 marked this conversation as resolved.
Show resolved Hide resolved
#include <android/font.h>
// <android/font_matcher.h> is broken without the following typedef in C
typedef struct AFontMatcher AFontMatcher;
#include <android/font_matcher.h>
#include <android/hardware_buffer.h>
#include <android/hardware_buffer_jni.h>
#include <android/hdr_metadata.h>
Expand Down Expand Up @@ -49,7 +53,9 @@
#include <android/surface_texture.h>
#include <android/surface_texture_jni.h>
#include <android/sync.h>
// #include <android/system_fonts.h>
// <android/system_fonts.h> is broken without the following typedef in C
typedef struct ASystemFontIterator ASystemFontIterator;
#include <android/system_fonts.h>
// #include <android/thermal.h>
#include <android/trace.h>
#include <android/versioning.h>
Expand Down
1 change: 1 addition & 0 deletions ndk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Bump optional `jni` dependency for doctest example from `0.19` to `0.21`. (#390)
- **Breaking:** Upgrade to [`ndk-sys 0.5.0`](../ndk-sys/CHANGELOG.md#050-TODO). (#370)
- **Breaking:** Upgrade `bitflags` crate from `1` to `2`. (#394)
- Add `Font` bindings. (#397)
- **Breaking:** Upgrade `num_enum` crate from `0.5.1` to `0.6`. (#398)
- **Breaking:** Renamed and moved "`media`" error types and helpers to a new `media_error` module. (#399)
- **Breaking:** media_codec: Wrap common dequeued-buffer status codes in enum. (#401)
Expand Down
Loading