Adiciona tinyblocks-opentype (fontes OpenType via FreeType) com teste e bundling no AppImage
This commit is contained in:
1 parent
a921f6574d
commit
22ae18f508
6 files changed
+577
-3
No files matched your search
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* TinyBlocks - tb_opentype.h
|
||||
* Library tinyblocks-opentype: leitura de fontes OpenType/TrueType (metricas,
|
||||
* contornos de glifos e rasterizacao de texto).
|
||||
*
|
||||
* Observacao: nao existe uma biblioteca C "libopentype" de facto; este modulo
|
||||
* usa a FreeType 2 (que faz o parsing de tabelas OpenType/TrueType: head, hhea,
|
||||
* hmtx, cmap, glyf/CFF, ...). E' o parser OpenType usado pela industria.
|
||||
*
|
||||
* Independente do editor.
|
||||
*/
|
||||
#ifndef TINYBLOCKS_OPENTYPE_H
|
||||
#define TINYBLOCKS_OPENTYPE_H
|
||||
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
|
||||
TB_API const TinyBlocks_LibraryDescriptor* tb_opentype_get_library(void);
|
||||
|
||||
/* -- API C --------------------------------------------------------------- */
|
||||
|
||||
/* Carrega uma fonte; devolve um handle (>0) ou 0 em erro. */
|
||||
TB_API int tb_opentype_load(const char* path);
|
||||
TB_API void tb_opentype_close(int handle);
|
||||
|
||||
TB_API int tb_opentype_units_per_em(int handle); /* 0 em erro */
|
||||
TB_API int tb_opentype_glyph_count(int handle);
|
||||
TB_API int tb_opentype_num_faces(int handle);
|
||||
TB_API bool tb_opentype_has_char(int handle, long codepoint);
|
||||
|
||||
/* Metricas em pixels para um tamanho: ascent/descent/height. */
|
||||
TB_API void tb_opentype_metrics(int handle, int pixel_size,
|
||||
double* ascent, double* descent, double* height);
|
||||
|
||||
/* Largura (avanco total) de um texto UTF-8 em pixels. */
|
||||
TB_API double tb_opentype_advance(int handle, const char* text, int pixel_size);
|
||||
|
||||
/* Contornos de um caractere (UTF-8) como lista de contornos, cada um uma
|
||||
* lista de pontos [x,y] em pixels; origem no canto superior esquerdo.
|
||||
* Devolve um array JSON (retido) ou NULL. */
|
||||
TB_API TinyBlocks_JsonValue* tb_opentype_outline(int handle, const char* text, int pixel_size);
|
||||
|
||||
/* Rasteriza um texto numa imagem RGBA (fundo transparente). */
|
||||
TB_API TinyBlocks_Image* tb_opentype_render(int handle, const char* text, int pixel_size,
|
||||
int r, int g, int b);
|
||||
|
||||
/* Caminho padrao de fonte do sistema (para testes/demos) ou NULL. */
|
||||
TB_API const char* tb_opentype_default_font(void);
|
||||
|
||||
TB_API const char* tb_opentype_last_error(void);
|
||||
|
||||
#endif /* TINYBLOCKS_OPENTYPE_H */
|
||||
Reference in new issue
Block a user