"No cap character found in font" - Why would that be?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 25.4k
- Forks
- 6.5k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 5
Description
Issue details
I am receiving multiple crash reports for one of my apps through Google Play. The error is "No cap character found in font" thrown on line 339 in FreeTypeGenerator.java.
It is occuring only on a Samsung Galaxy Tab S2 (gts28vewifi). It has not been reported on any other specific device and I have not been able to reproduce it either by running my app on desktop through lwjgl3 or setting up an emulator with similar specs.
I have been peeking around in FreeTypeGenerator.java without finding any clues. Only way I have been able to reproduce it is by setting font size to 0, as reported in at least one other issue here. It is highly unlikely that this is the case on the specific device, since I can not find any way the font size would end up as 0.
Can anyone speculate some reason that the exception would be thrown, apart from size being 0? Or must that afterall be the reason?
Reproduction steps/code
I have not been able to reproduce the issue since I do not posess a Samsung Galaxy Tab S2. This is however the method in which the exception occurs. The size parameter will be 19 multiplied by Gdx.graphics.getDensity(), so probably size=38 for the Samsung Galaxy Tab S2.
private static BitmapFont generateBitmapFont(String fontFileName, String text, Color color, float size) {
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal(fontFileName));
FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
parameter.size = Math.round(size);
parameter.color = color;
parameter.characters = text;
parameter.minFilter = Texture.TextureFilter.Linear;
parameter.magFilter = Texture.TextureFilter.Linear;
BitmapFont bitmapFont = generator.generateFont(parameter); // <--- LoadingScreen.generateBitmapFont line 67
generator.dispose();
return bitmapFont;
}
Gdx.graphics.getDensity() is also wrapped in some code to guarantee a valid result:
try {
return Math.max(1f, Gdx.graphics.getDensity());
}
catch(NullPointerException e){
e.printStackTrace();
return 1;
}
Version of libGDX and/or relevant dependencies
gdxVersion = '1.10.0'
Stacktrace
com.badlogic.gdx.utils.GdxRuntimeException:
at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateData (FreeTypeFontGenerator.java:339)
at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateFont (FreeTypeFontGenerator.java:161)
at com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.generateFont (FreeTypeFontGenerator.java:152)
at info.casualcomputing.sputter.ui.LoadingScreen.generateBitmapFont (LoadingScreen.java:67)
at info.casualcomputing.sputter.ui.LoadingScreen.<init> (LoadingScreen.java:38)
at info.casualcomputing.sputter.ui.GridSequencerView.create (GridSequencerView.java:130)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged (AndroidGraphics.java:277)
at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1546)
at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1262)
Please select the affected platforms
- Android
- iOS
- HTML/GWT
- Windows
- Linux
- macOS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with FreeTypeGenerator.java:339 and the generateFont calls shown in the stack trace, then compare the Android and Windows paths. Investigate why the reported Samsung Galaxy Tab S2 case reaches the exception without a reproducible example. Done means identifying a reproducible cause or documenting the missing conditions needed to diagnose it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100