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

Fix freetype font loading when using AndroidZipFile #3475

Merged
merged 1 commit into from Oct 9, 2015

Conversation

@sarkanyi
Copy link
Contributor

sarkanyi commented Oct 9, 2015

FreeType fonts look for the sibling of a file, which in case of AndroidZipFile might be in the internal rather the obb file itself. This patch fixes this case and also adds a test inside the APKExpansionTest.

@MobiDevelop
MobiDevelop reviewed Oct 9, 2015
View changes
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidZipFileHandle.java Outdated
@@ -84,7 +84,7 @@ public FileHandle child(String name) {
public FileHandle sibling(String name) {
if (file.getPath().length() == 0)
throw new GdxRuntimeException("Cannot get the sibling of the root.");
return new AndroidZipFileHandle(new File(file.getParent(), name), type);
return Gdx.files.internal(file.getParent() + "/" + name); //this way we can find the sibling even if it's not inside the obb

This comment has been minimized.

Copy link
@MobiDevelop

MobiDevelop Oct 9, 2015

Member

Perhaps Gdx.files.getFileHandle(new File(file.getParent(), name).getPath(), type); instead.

This comment has been minimized.

Copy link
@sarkanyi

sarkanyi Oct 9, 2015

Author Contributor

Type should always be Internal in case of AndroidZipFiles, but can do if you think.

This comment has been minimized.

Copy link
@MobiDevelop

MobiDevelop Oct 9, 2015

Member

I'd prefer to not make the assumption in case at some point we decide we need to have some other file type that better suits this.

@sarkanyi sarkanyi force-pushed the sarkanyi:master branch to 7e4c3d8 Oct 9, 2015
MobiDevelop added a commit that referenced this pull request Oct 9, 2015
Fix freetype font loading when using AndroidZipFile
@MobiDevelop MobiDevelop merged commit 0f23723 into libgdx:master Oct 9, 2015
1 check passed
1 check passed
PR Check No test results found.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.