* Retrieve scale plugin from lite-plugins * New implementation of scale plugin and font C API Introduce two new C API functions, renderer.font.get_size and set_size respectively to get the font size and to set the size to a new value. Using these functions we don't need to know the name of the font but we can just change their size. Adapt the scale plugin to use the new C API function with minor adaptations in the logic. Use smaller step to scale fonts. Rename font_desc_free function, previous name was misleading as only the cached resources are freed. * Add contextmenu plugin from takase From https://github.com/takase1121/lite-contextmenu Adapted to show font scaling commands and find/replace commands. i# testing.lua * Fix the cursor flickering with contextmenu To avoid flickering of the cursor when using the context menu we add a new function `core.request_cursor` that just take note of the cursor requested. The cursor will be actually changed only in root_view:draw() method only when all the drawing operations are done. This means the cursor will be changed only once per frame and only the most recent cursor change request will take effect. * Remove unneeded scale plugin return functions
34 lines
867 B
C
34 lines
867 B
C
#ifndef FONT_DESC_H
|
|
#define FONT_DESC_H
|
|
|
|
typedef struct RenFont RenFont;
|
|
|
|
struct FontInstance {
|
|
RenFont *font;
|
|
short int scale;
|
|
};
|
|
typedef struct FontInstance FontInstance;
|
|
|
|
#define FONT_CACHE_ARRAY_MAX 2
|
|
|
|
struct FontDesc {
|
|
float size;
|
|
unsigned int options;
|
|
short int tab_size;
|
|
FontInstance cache[FONT_CACHE_ARRAY_MAX];
|
|
short int cache_length;
|
|
short int cache_last_index; /* More recently used instance. */
|
|
char filename[0];
|
|
};
|
|
typedef struct FontDesc FontDesc;
|
|
|
|
void font_desc_init(FontDesc *font_desc, const char *filename, float size, unsigned int font_options);
|
|
int font_desc_alloc_size(const char *filename);
|
|
int font_desc_get_tab_size(FontDesc *font_desc);
|
|
void font_desc_set_tab_size(FontDesc *font_desc, int tab_size);
|
|
void font_desc_clear(FontDesc *font_desc);
|
|
RenFont *font_desc_get_font_at_scale(FontDesc *font_desc, int scale);
|
|
|
|
#endif
|
|
|