bidi works in terminal in grub-emu
This commit is contained in:
parent
dfed5c6bb4
commit
0a239a8211
23 changed files with 1101 additions and 799 deletions
|
@ -118,10 +118,8 @@ grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize);
|
|||
int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg,
|
||||
grub_uint32_t **last_position);
|
||||
|
||||
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest,
|
||||
grub_size_t destsize,
|
||||
const grub_uint8_t *src,
|
||||
grub_size_t srcsize,
|
||||
grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize,
|
||||
const grub_uint8_t *src, grub_size_t srcsize,
|
||||
const grub_uint8_t **srcend);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/unicode.h>
|
||||
|
||||
/* Forward declaration of opaque structure grub_font.
|
||||
Users only pass struct grub_font pointers to the font module functions,
|
||||
|
@ -117,4 +118,11 @@ grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
|
|||
grub_video_color_t color,
|
||||
int left_x, int baseline_y);
|
||||
|
||||
int
|
||||
EXPORT_FUNC (grub_font_get_constructed_device_width) (grub_font_t hinted_font,
|
||||
const struct grub_unicode_glyph *glyph_id);
|
||||
struct grub_font_glyph *
|
||||
EXPORT_FUNC (grub_font_construct_glyph) (grub_font_t hinted_font,
|
||||
const struct grub_unicode_glyph *glyph_id);
|
||||
|
||||
#endif /* ! GRUB_FONT_HEADER */
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
|
||||
extern grub_uint8_t grub_console_cur_color;
|
||||
|
||||
void grub_console_putchar (grub_uint32_t c);
|
||||
grub_ssize_t grub_console_getcharwidth (grub_uint32_t c);
|
||||
void
|
||||
grub_console_putchar (const struct grub_unicode_glyph *c);
|
||||
grub_ssize_t
|
||||
grub_console_getcharwidth (const struct grub_unicode_glyph *c);
|
||||
grub_uint16_t grub_console_getwh (void);
|
||||
void grub_console_setcolorstate (grub_term_color_state state);
|
||||
void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
|
||||
|
|
|
@ -113,4 +113,6 @@ void grub_set_more (int onoff);
|
|||
int grub_normal_get_line_counter (void);
|
||||
void grub_install_newline_hook (void);
|
||||
|
||||
void grub_xputs_normal (const char *str);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/unicode.h>
|
||||
|
||||
/* These are used to represent the various color states we use. */
|
||||
typedef enum
|
||||
|
@ -164,11 +165,11 @@ struct grub_term_output
|
|||
grub_err_t (*fini) (void);
|
||||
|
||||
/* Put a character. C is encoded in Unicode. */
|
||||
void (*putchar) (grub_uint32_t c);
|
||||
void (*putchar) (const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Get the number of columns occupied by a given character C. C is
|
||||
encoded in Unicode. */
|
||||
grub_ssize_t (*getcharwidth) (grub_uint32_t c);
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *c);
|
||||
|
||||
/* Get the screen size. The return value is ((Width << 8) | Height). */
|
||||
grub_uint16_t (*getwh) (void);
|
||||
|
@ -261,8 +262,7 @@ grub_term_unregister_output (grub_term_output_t term)
|
|||
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next)
|
||||
|
||||
void EXPORT_FUNC(grub_putcode) (grub_uint32_t code,
|
||||
struct grub_term_output *term);
|
||||
void grub_putcode (grub_uint32_t code, struct grub_term_output *term);
|
||||
int EXPORT_FUNC(grub_getkey) (void);
|
||||
int EXPORT_FUNC(grub_checkkey) (void);
|
||||
int EXPORT_FUNC(grub_getkeystatus) (void);
|
||||
|
@ -379,7 +379,8 @@ grub_term_cls (struct grub_term_output *term)
|
|||
}
|
||||
|
||||
static inline grub_ssize_t
|
||||
grub_term_getcharwidth (struct grub_term_output *term, grub_uint32_t c)
|
||||
grub_term_getcharwidth (struct grub_term_output *term,
|
||||
const struct grub_unicode_glyph *c)
|
||||
{
|
||||
if (term->getcharwidth)
|
||||
return term->getcharwidth (c);
|
||||
|
|
|
@ -55,6 +55,7 @@ enum grub_bidi_type
|
|||
|
||||
enum grub_comb_type
|
||||
{
|
||||
GRUB_UNICODE_COMB_NONE = 0,
|
||||
GRUB_UNICODE_COMB_OVERLAY = 1,
|
||||
GRUB_UNICODE_STACK_ATTACHED_BELOW = 202,
|
||||
GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214,
|
||||
|
@ -93,4 +94,21 @@ extern struct grub_unicode_compact_range grub_unicode_compact[];
|
|||
/* Unicode mandates an arbitrary limit. */
|
||||
#define GRUB_BIDI_MAX_EXPLICIT_LEVEL 61
|
||||
|
||||
grub_ssize_t
|
||||
grub_bidi_logical_to_visual (const grub_uint32_t *logical,
|
||||
grub_size_t logical_len,
|
||||
struct grub_unicode_glyph **visual_out,
|
||||
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual),
|
||||
grub_size_t max_length);
|
||||
|
||||
enum grub_comb_type
|
||||
grub_unicode_get_comb_type (grub_uint32_t c);
|
||||
grub_size_t
|
||||
grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
||||
struct grub_unicode_glyph *out);
|
||||
struct grub_unicode_glyph *
|
||||
grub_unicode_glyph_from_code (grub_uint32_t code);
|
||||
struct grub_unicode_glyph *
|
||||
grub_unicode_glyph_dup (const struct grub_unicode_glyph *in);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue