1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-14 02:42:46 -07:00

Avert a crash in the Android last resort font driver

* java/org/gnu/emacs/EmacsFontDriver.java (FONT_INVALID_CODE):
New constant.
(hasChar, encodeChar): Accept a jint character code rather than
a jchar.

* java/org/gnu/emacs/EmacsSdk23FontDriver.java (hasChar)
(encodeChar): Return 0 or FONT_INVALID_CODE if the character is
not representable in a Java char.

* java/org/gnu/emacs/EmacsSdk7FontDriver.java (hasChar): Ditto.

* src/androidfont.c (android_init_font_driver): Adjust signature
to match.
This commit is contained in:
Po Lu 2023-09-14 16:53:04 +08:00
parent f13b08be11
commit 6ffb0a1719
4 changed files with 31 additions and 10 deletions

View file

@ -63,6 +63,11 @@ public abstract class EmacsFontDriver
public static final int MONO = 100;
public static final int CHARCELL = 110;
/* Special glyph codes. */
public static final int FONT_INVALID_CODE = 0xFFFFFFFF;
public static class FontSpec
{
/* The fields below mean the same as they do in enum
@ -148,15 +153,17 @@ public abstract class EmacsFontDriver
}
};
/* These mean the same as they do in struct font_driver. */
public abstract FontEntity[] list (FontSpec fontSpec);
public abstract FontEntity match (FontSpec fontSpec);
public abstract String[] listFamilies ();
public abstract FontObject openFont (FontEntity fontEntity, int pixelSize);
public abstract int hasChar (FontSpec font, char charCode);
public abstract int hasChar (FontSpec font, int charCode);
public abstract void textExtents (FontObject font, int code[],
FontMetrics fontMetrics);
public abstract int encodeChar (FontObject fontObject, char charCode);
public abstract int encodeChar (FontObject fontObject, int charCode);
public abstract int draw (FontObject fontObject, EmacsGC gc,
EmacsDrawable drawable, int[] chars,
int x, int y, int backgroundWidth,