mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-28 16:17:09 +08:00
Compare commits
164
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b01f35cac | ||
|
|
e0b6a64402 | ||
|
|
084d7e58a2 | ||
|
|
88753a5fd0 | ||
|
|
b739daadba | ||
|
|
5529ab1e10 | ||
|
|
032fdcc3bb | ||
|
|
1cb9922dad | ||
|
|
8ac0d539d0 | ||
|
|
e3ae994212 | ||
|
|
b0145a15d2 | ||
|
|
9dab380f3e | ||
|
|
d1facd5468 | ||
|
|
5996ede23b | ||
|
|
837cd49045 | ||
|
|
dc4f54ffe4 | ||
|
|
f611fe3859 | ||
|
|
4ff5097dfb | ||
|
|
49421e1f88 | ||
|
|
6e33602e7d | ||
|
|
d13c31a08a | ||
|
|
704b6287ff | ||
|
|
1df726dd10 | ||
|
|
b2afe815b5 | ||
|
|
f648c1a8c7 | ||
|
|
4d2fe61e52 | ||
|
|
9644964e9c | ||
|
|
61b799af88 | ||
|
|
2f52006cde | ||
|
|
cf063aad32 | ||
|
|
0855e8b972 | ||
|
|
a501557532 | ||
|
|
820d6aeac4 | ||
|
|
215242e3e8 | ||
|
|
c79f09fe87 | ||
|
|
f68c26860a | ||
|
|
53f1a05526 | ||
|
|
6a5cfd1052 | ||
|
|
1c79cf510f | ||
|
|
86965a0e9c | ||
|
|
9cca87878c | ||
|
|
2cffa1154c | ||
|
|
9adea7df64 | ||
|
|
8f70dfcf69 | ||
|
|
ccf1e6f7a5 | ||
|
|
913ea4db23 | ||
|
|
55baa8c741 | ||
|
|
db63d8cad3 | ||
|
|
338fb0276e | ||
|
|
8dd64e7f2d | ||
|
|
c1cbb8423e | ||
|
|
a95ee5b181 | ||
|
|
9d9bf95c21 | ||
|
|
ed6ceaa49c | ||
|
|
f5e1144cbe | ||
|
|
c890e4296a | ||
|
|
d09313407e | ||
|
|
7dfe5954f5 | ||
|
|
390c5de6ef | ||
|
|
274fdaaa31 | ||
|
|
04725fc892 | ||
|
|
4da29f635d | ||
|
|
3e5ff0af91 | ||
|
|
1820e74b77 | ||
|
|
2278c4975c | ||
|
|
af8a04570d | ||
|
|
452edfa831 | ||
|
|
4fba705082 | ||
|
|
a049e387e0 | ||
|
|
c67a18536d | ||
|
|
d9e09ac34f | ||
|
|
65972861a0 | ||
|
|
96b06544b3 | ||
|
|
838530d6b1 | ||
|
|
c276122f60 | ||
|
|
46a8b1768a | ||
|
|
d5b57e8200 | ||
|
|
ee179e6995 | ||
|
|
3571d88f3d | ||
|
|
8ba346eec5 | ||
|
|
e110cb61f4 | ||
|
|
d29aa1d881 | ||
|
|
6337f5d6fa | ||
|
|
14bfe263a3 | ||
|
|
cbd54e0766 | ||
|
|
ceaec7e3d3 | ||
|
|
aab8d6e2c6 | ||
|
|
8a856e5b99 | ||
|
|
46f48a0d6c | ||
|
|
40fc11f324 | ||
|
|
d63fe9849b | ||
|
|
349f310148 | ||
|
|
ac60980bc2 | ||
|
|
e7002ad870 | ||
|
|
6838a67e7d | ||
|
|
9a8d997f63 | ||
|
|
f8b0a89d90 | ||
|
|
72f61f17be | ||
|
|
676dd0e6da | ||
|
|
02c7a6e07c | ||
|
|
8f841a0bc0 | ||
|
|
f218b7b892 | ||
|
|
1e1dd76fb1 | ||
|
|
4ba0bcd0fe | ||
|
|
cc9d9f6d42 | ||
|
|
4c9e8138b1 | ||
|
|
f79a1bd86a | ||
|
|
211135fbc5 | ||
|
|
537b659fc7 | ||
|
|
6b45b74e32 | ||
|
|
0ceb5616bf | ||
|
|
62f9cf9e48 | ||
|
|
6842cd3933 | ||
|
|
2c5ddd93cb | ||
|
|
64ddca1e2f | ||
|
|
9dea317925 | ||
|
|
a4e8a42707 | ||
|
|
005519e7cc | ||
|
|
da7c2175dd | ||
|
|
c7e6a867f4 | ||
|
|
30c6033e8c | ||
|
|
5a5d5d3bbb | ||
|
|
bdd75353d2 | ||
|
|
ce7b9eccca | ||
|
|
c66f1a5fa3 | ||
|
|
ba240cd53b | ||
|
|
ca9d0200f3 | ||
|
|
5dd2a21919 | ||
|
|
11124ef8a0 | ||
|
|
e8714be5ef | ||
|
|
13341e864c | ||
|
|
e1a464b32f | ||
|
|
a7601d8cfe | ||
|
|
98ae3a6b35 | ||
|
|
f82e15ed5e | ||
|
|
690f5487ab | ||
|
|
4e0a9a8d37 | ||
|
|
c6f1004ba6 | ||
|
|
a4e9f56c08 | ||
|
|
d84a7ffbbe | ||
|
|
11865764da | ||
|
|
fdc449335d | ||
|
|
27e508848d | ||
|
|
cc01ce0bbc | ||
|
|
0093ac3edc | ||
|
|
45db7410c0 | ||
|
|
e6df345736 | ||
|
|
e7b05090cd | ||
|
|
b82128091e | ||
|
|
adab30261c | ||
|
|
7e0b378475 | ||
|
|
d1ef9e2598 | ||
|
|
5887668b17 | ||
|
|
e6cb8f272b | ||
|
|
90e4ee91fe | ||
|
|
83207ca329 | ||
|
|
dcd31bed7c | ||
|
|
76cf8a02af | ||
|
|
10d8b43c61 | ||
|
|
554b709890 | ||
|
|
d877e86adc | ||
|
|
c5e5bd01e8 | ||
|
|
e3760457c4 | ||
|
|
c6ed1626f9 |
+1
-1
@@ -161,7 +161,7 @@ Please report any bugs and incompatibilities in
|
||||
1. Add `__mg_save_jpg` function for storing MYBITMAP as JPEG file (@10km).
|
||||
1. Modified logic for checking JPEG format (@10km).
|
||||
1. Support BIDI for UNICODE charsets and cleanup the implementation.
|
||||
* New API: `GetGlyphBIDIType` to get the glyph type in BIDI.
|
||||
* New API: `GetGlyphBidiType` to get the glyph type in BIDI.
|
||||
* New DC attribute: BIDI flag.
|
||||
1. Enhance commlcd engint to support more pixel type and synchronously update.
|
||||
1. New USVFB IAL engine and NEWGAL engine for web display server.
|
||||
|
||||
+92
-79
File diff suppressed because it is too large
Load Diff
+75
-36
@@ -169,10 +169,10 @@ typedef signed int Sint32;
|
||||
/* Figure out how to support 64-bit datatypes */
|
||||
#if !defined(__STRICT_ANSI__)
|
||||
# if defined(__GNUC__)
|
||||
# define MGUI_HAS_64BIT_TYPE long long
|
||||
# define MGUI_HAS_64BIT_TYPE long long
|
||||
# endif
|
||||
# if defined(__CC_ARM)
|
||||
# define MGUI_HAS_64BIT_TYPE long long
|
||||
# define MGUI_HAS_64BIT_TYPE long long
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
# define MGUI_HAS_64BIT_TYPE __int64
|
||||
@@ -199,8 +199,8 @@ typedef signed MGUI_HAS_64BIT_TYPE Sint64;
|
||||
#else
|
||||
/* This is really just a hack to prevent the compiler from complaining */
|
||||
typedef struct {
|
||||
Uint32 hi;
|
||||
Uint32 lo;
|
||||
Uint32 hi;
|
||||
Uint32 lo;
|
||||
} Uint64, Sint64;
|
||||
#endif
|
||||
|
||||
@@ -221,6 +221,38 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
|
||||
/** @} end of basic_types */
|
||||
|
||||
/* Here we provide MG_GNUC_EXTENSION as an alias for __extension__,
|
||||
* where this is valid. This allows for warningless compilation of
|
||||
* "long long" types even in the presence of '-ansi -pedantic'.
|
||||
*/
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
|
||||
#define MG_GNUC_EXTENSION __extension__
|
||||
#else
|
||||
#define MG_GNUC_EXTENSION
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The MG_LIKELY and MG_UNLIKELY macros let the programmer give hints to
|
||||
* the compiler about the expected result of an expression. Some compilers
|
||||
* can use this information for optimizations.
|
||||
*/
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
||||
#define _MG_BOOLEAN_EXPR(expr) \
|
||||
MG_GNUC_EXTENSION ({ \
|
||||
int _g_boolean_var_; \
|
||||
if (expr) \
|
||||
_g_boolean_var_ = 1; \
|
||||
else \
|
||||
_g_boolean_var_ = 0; \
|
||||
_g_boolean_var_; \
|
||||
})
|
||||
#define MG_LIKELY(expr) (__builtin_expect (_MG_BOOLEAN_EXPR(expr), 1))
|
||||
#define MG_UNLIKELY(expr) (__builtin_expect (_MG_BOOLEAN_EXPR(expr), 0))
|
||||
#else
|
||||
#define MG_LIKELY(expr) (expr)
|
||||
#define MG_UNLIKELY(expr) (expr)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \defgroup endian_info Endianness information
|
||||
* @{
|
||||
@@ -846,25 +878,28 @@ typedef DWORD32 RGBCOLOR;
|
||||
* \brief Makes a RGBA triple value from red \a r, green \a g,
|
||||
* blue \a b and alpha \a components.
|
||||
*
|
||||
* \note The red, green, blue and alpha components are all ranged from 0 to 255,
|
||||
* and the returned value will be a double word.
|
||||
* \note The red, green, blue, and alpha components are all ranged
|
||||
* from 0 to 255, and the returned value will be a 32-bit double word.
|
||||
*
|
||||
* \sa GetRValue, GetGValue, GetBValue, GetAValue
|
||||
*/
|
||||
#define MakeRGBA(r, g, b, a) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
|
||||
| ((DWORD32)((BYTE)(b)) << 16) | ((DWORD32)((BYTE)(a)) << 24))
|
||||
#define MakeRGBA(r, g, b, a) \
|
||||
(((DWORD32)((BYTE)(r))) \
|
||||
| ((DWORD32)((BYTE)(g)) << 8) \
|
||||
| ((DWORD32)((BYTE)(b)) << 16) \
|
||||
| ((DWORD32)((BYTE)(a)) << 24))
|
||||
|
||||
/**
|
||||
* \def MakeRGB(r, g, b)
|
||||
* \brief Makes a RGB triple value from red \a r, green \a g, and blue \a b components.
|
||||
* \brief Makes a RGB triple value from red \a r, green \a g,
|
||||
* and blue \a b components.
|
||||
*
|
||||
* \note The red, green, and blue components are all ranged from 0 to 255,
|
||||
* and the returned value will be a double word.
|
||||
* and the returned value will be a 32-bit double word.
|
||||
*
|
||||
* \sa GetRValue, GetGValue, GetBValue
|
||||
* \sa GetRValue, GetGValue, GetBValue, GetAValue
|
||||
*/
|
||||
#define MakeRGB(r, g, b) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
|
||||
| ((DWORD32)((BYTE)(b)) << 16))
|
||||
#define MakeRGB(r, g, b) MakeRGBA((r), (g), (b), 255)
|
||||
|
||||
/**
|
||||
* A rectangle defined by coordinates of corners.
|
||||
@@ -875,8 +910,7 @@ typedef DWORD32 RGBCOLOR;
|
||||
*
|
||||
* \sa PRECT, GAL_Rect
|
||||
*/
|
||||
typedef struct _RECT
|
||||
{
|
||||
typedef struct _RECT {
|
||||
/**
|
||||
* The x coordinate of the upper-left corner of the rectangle.
|
||||
*/
|
||||
@@ -1776,12 +1810,12 @@ struct tm {
|
||||
#include "os_type.h"
|
||||
#include "os_file_api.h"
|
||||
|
||||
#define fopen tp_fopen
|
||||
#define fclose tp_fclose
|
||||
#define fwrite tp_fwrite
|
||||
#define fread tp_fread
|
||||
#define fseek tp_fseek
|
||||
#define feof tp_feof
|
||||
#define fopen tp_fopen
|
||||
#define fclose tp_fclose
|
||||
#define fwrite tp_fwrite
|
||||
#define fread tp_fread
|
||||
#define fseek tp_fseek
|
||||
#define feof tp_feof
|
||||
|
||||
#undef assert
|
||||
#define _HAVE_ASSERT 1
|
||||
@@ -1905,8 +1939,8 @@ int init_minigui_printf (int (*output_char) (int ch),
|
||||
|
||||
#ifdef WIN32
|
||||
# include <float.h>
|
||||
# define isnan _isnan
|
||||
# define finite _finite
|
||||
# define isnan _isnan
|
||||
# define finite _finite
|
||||
#endif
|
||||
|
||||
#undef _I18N_MB_REQUIRED
|
||||
@@ -2055,6 +2089,22 @@ int init_minigui_printf (int (*output_char) (int ch),
|
||||
#define TCS_CLRLINE(fp)
|
||||
#endif
|
||||
|
||||
#define _MG_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_GREEN (stdout); \
|
||||
fprintf (stdout, fmt, ##__VA_ARGS__); \
|
||||
TCS_NONE (stdout); \
|
||||
} while (0)
|
||||
|
||||
#define _WRN_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_BROWN (stderr); \
|
||||
fprintf (stderr, "%s: ", __FUNCTION__); \
|
||||
fprintf (stderr, fmt, ##__VA_ARGS__); \
|
||||
fprintf (stderr, "\n"); \
|
||||
TCS_NONE (stderr); \
|
||||
} while (0)
|
||||
|
||||
#define _ERR_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_RED (stderr); \
|
||||
@@ -2062,25 +2112,14 @@ int init_minigui_printf (int (*output_char) (int ch),
|
||||
TCS_NONE (stderr); \
|
||||
} while (0)
|
||||
|
||||
#ifdef _DEBUG
|
||||
# define _MG_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_GREEN (stdout); \
|
||||
fprintf (stdout, fmt, ##__VA_ARGS__); \
|
||||
TCS_NONE (stdout); \
|
||||
} while (0)
|
||||
# ifdef DEBUG
|
||||
# define _DBG_PRINTF(fmt, ...) \
|
||||
#if defined(_DEBUG)
|
||||
# define _DBG_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_YELLOW (stderr); \
|
||||
fprintf (stderr, fmt, ##__VA_ARGS__); \
|
||||
TCS_NONE (stderr); \
|
||||
} while (0)
|
||||
# else
|
||||
# define _DBG_PRINTF(fmt, ...)
|
||||
# endif
|
||||
#else
|
||||
# define _MG_PRINTF(fmt, ...)
|
||||
# define _DBG_PRINTF(fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
+21
-21
@@ -151,9 +151,9 @@ MG_EXPORT fixed fixatan (fixed x);
|
||||
*/
|
||||
MG_EXPORT fixed fixatan2 (fixed y, fixed x);
|
||||
|
||||
extern MG_EXPORT fixed _cos_tbl[];
|
||||
extern MG_EXPORT fixed _tan_tbl[];
|
||||
extern MG_EXPORT fixed _acos_tbl[];
|
||||
extern MG_EXPORT const fixed __mg_cos_tbl[];
|
||||
extern MG_EXPORT const fixed __mg_tan_tbl[];
|
||||
extern MG_EXPORT const fixed __mg_acos_tbl[];
|
||||
|
||||
/************************** inline fixed point math functions *****************/
|
||||
/* ftofix and fixtof are used in generic C versions of fixmul and fixdiv */
|
||||
@@ -220,19 +220,19 @@ static inline fixed fixadd (fixed x, fixed y)
|
||||
|
||||
if (result >= 0) {
|
||||
if ((x < 0) && (y < 0)) {
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y > 0)) {
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,19 +257,19 @@ static inline fixed fixsub (fixed x, fixed y)
|
||||
|
||||
if (result >= 0) {
|
||||
if ((x < 0) && (y > 0)) {
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
errno = ERANGE;
|
||||
return -0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y < 0)) {
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ static inline fixed itofix (int x)
|
||||
*/
|
||||
static inline int fixtoi (fixed x)
|
||||
{
|
||||
return (x >> 16) + ((x & 0x8000) >> 15);
|
||||
return (x >> 16) + ((x & 0x8000) >> 15);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -364,7 +364,7 @@ static inline int fixtoi (fixed x)
|
||||
*/
|
||||
static inline fixed fixcos (fixed x)
|
||||
{
|
||||
return _cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
|
||||
return __mg_cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +378,7 @@ static inline fixed fixcos (fixed x)
|
||||
*/
|
||||
static inline fixed fixsin (fixed x)
|
||||
{
|
||||
return _cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
|
||||
return __mg_cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,7 +392,7 @@ static inline fixed fixsin (fixed x)
|
||||
*/
|
||||
static inline fixed fixtan (fixed x)
|
||||
{
|
||||
return _tan_tbl[((x + 0x4000) >> 15) & 0xFF];
|
||||
return __mg_tan_tbl[((x + 0x4000) >> 15) & 0xFF];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,7 +415,7 @@ static inline fixed fixacos (fixed x)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _acos_tbl[(x+65536+127)>>8];
|
||||
return __mg_acos_tbl[(x+65536+127)>>8];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -438,7 +438,7 @@ static inline fixed fixasin (fixed x)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0x00400000 - _acos_tbl[(x+65536+127)>>8];
|
||||
return 0x00400000 - __mg_acos_tbl[(x+65536+127)>>8];
|
||||
}
|
||||
|
||||
/** @} end of fixed_math_fns */
|
||||
|
||||
+2987
-1271
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -4865,7 +4865,7 @@ MG_EXPORT void* GetResource (RES_KEY key);
|
||||
*
|
||||
* When you get a resource, you should call this function to ensure that
|
||||
* the resource can not be unloaded when you still use it.
|
||||
* This function must be called after LoadResource.
|
||||
* This function must be called after GetResource.
|
||||
*
|
||||
* \param key The key of resource (use Str2Key(res_name) to get the key).
|
||||
*
|
||||
|
||||
+29
-29
@@ -451,17 +451,17 @@ static void print_ranges(int* ranges, int nr_ranges, PBIDISLEDITDATA sled)
|
||||
int start_byte_index = get_achar_text_index(sled, sled->selStart);
|
||||
int end_byte_index = get_achar_text_index (sled, sled->selEnd);
|
||||
if(ranges){
|
||||
_MG_PRINTF("sel_achar-[%d,%d], sel_byte = [%d, %d]\n",
|
||||
_DBG_PRINTF("sel_achar-[%d,%d], sel_byte = [%d, %d]\n",
|
||||
sled->selStart, sled->selEnd,
|
||||
start_byte_index, end_byte_index);
|
||||
|
||||
_MG_PRINTF("nr_ranges = %d.\n ranges = ", nr_ranges);
|
||||
_DBG_PRINTF("nr_ranges = %d.\n ranges = ", nr_ranges);
|
||||
for (i=0; i<nr_ranges; i++)
|
||||
{
|
||||
_MG_PRINTF ("[%d, %d)-",
|
||||
_DBG_PRINTF ("[%d, %d)-",
|
||||
ranges[i<<1], ranges[(i<<1)+1]);
|
||||
}
|
||||
_MG_PRINTF("\n");
|
||||
_DBG_PRINTF("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -537,11 +537,11 @@ static void slePaint (HWND hWnd, HDC hdc, PBIDISLEDITDATA sled)
|
||||
|
||||
/* draw normal string. */
|
||||
setup_dc (hWnd, sled, hdc, FALSE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string, len, NULL, NULL);
|
||||
/* draw selected string.*/
|
||||
setup_dc (hWnd, sled, hdc, TRUE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string + len, *(p + 1) - *p, NULL, NULL);
|
||||
|
||||
achar_string = ACHARS + *(p + 1);
|
||||
@@ -553,28 +553,28 @@ static void slePaint (HWND hWnd, HDC hdc, PBIDISLEDITDATA sled)
|
||||
/* draw the last rest normal string if necessary.*/
|
||||
if (p && ACHARSLEN > *(p-1)) {
|
||||
setup_dc (hWnd, sled, hdc, FALSE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string, ACHARSLEN - *(p - 1), NULL, NULL);
|
||||
}
|
||||
else if(!p || nr_ranges == 0){
|
||||
/* draw first normal chars */
|
||||
if (sled->selStart > 0) {
|
||||
setup_dc (hWnd, sled, hdc, FALSE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string, sled->selStart, NULL, NULL);
|
||||
achar_string += sled->selStart;
|
||||
}
|
||||
|
||||
/* draw selected chars */
|
||||
setup_dc (hWnd, sled, hdc, TRUE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string, sled->selEnd - sled->selStart, NULL, NULL);
|
||||
achar_string += sled->selEnd - sled->selStart;
|
||||
|
||||
/* draw others */
|
||||
if (sled->selEnd < ACHARSLEN) {
|
||||
setup_dc (hWnd, sled, hdc, FALSE);
|
||||
outw += DrawGlyphString (hdc, startx + outw, starty,
|
||||
outw += DrawACharString (hdc, startx + outw, starty,
|
||||
achar_string, ACHARSLEN - sled->selEnd, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ static void slePaint (HWND hWnd, HDC hdc, PBIDISLEDITDATA sled)
|
||||
setup_dc (hWnd, sled, hdc, FALSE);
|
||||
startx = sled->startx;
|
||||
sleContentToWindow (sled, &startx);
|
||||
DrawGlyphString (hdc, startx, starty, achar_string, ACHARSLEN, NULL, NULL);
|
||||
DrawACharString (hdc, startx, starty, achar_string, ACHARSLEN, NULL, NULL);
|
||||
}
|
||||
|
||||
if (dwStyle & ES_PASSWORD)
|
||||
@@ -638,14 +638,14 @@ static void set_caret_pos (HWND hWnd, PBIDISLEDITDATA sled, int x, BOOL bSel)
|
||||
txtsize.cx = 0;
|
||||
}
|
||||
else {
|
||||
out_achars = GetGlyphsExtentPoint (hdc, ACHARS, ACHARSLEN,
|
||||
out_achars = GetACharsExtentPoint (hdc, ACHARS, ACHARSLEN,
|
||||
x - sled->startx, &txtsize);
|
||||
#ifdef _DEBUG
|
||||
if(out_achars <= ACHARSLEN){
|
||||
out_chars = get_achar_text_index(sled, out_achars);
|
||||
}
|
||||
_DBG_PRINTF ("editPos=%d,out_chars=%d\n", out_achars, out_chars);
|
||||
#endif
|
||||
_MG_PRINTF ("editPos=%d,out_chars=%d\n", out_achars, out_chars);
|
||||
}
|
||||
if (!bSel) {
|
||||
sled->selStart = sled->selEnd = 0;
|
||||
@@ -694,7 +694,7 @@ make_charpos_visible (HWND hWnd, PBIDISLEDITDATA sled, int achar_pos, int *cx)
|
||||
achar_pos = ACHARSLEN;
|
||||
|
||||
hdc = GetClientDC (hWnd);
|
||||
GetGlyphsExtent (hdc, ACHARS, achar_pos, &achars_size);
|
||||
GetACharsExtent (hdc, ACHARS, achar_pos, &achars_size);
|
||||
ReleaseDC (hdc);
|
||||
}
|
||||
if (cx)
|
||||
@@ -799,7 +799,7 @@ static int sleMouseMove (HWND hWnd, PBIDISLEDITDATA sled, LPARAM lParam)
|
||||
sled->selEnd = ACHARSLEN;
|
||||
//sled->nContX = sled->nContW - (sled->rcVis.right - sled->rcVis.left);
|
||||
hdc = GetClientDC (hWnd);
|
||||
sled->nContX = GetGlyphsExtent (hdc, ACHARS, ACHARSLEN, &size) - (sled->rcVis.right - sled->rcVis.left);
|
||||
sled->nContX = GetACharsExtent (hdc, ACHARS, ACHARSLEN, &size) - (sled->rcVis.right - sled->rcVis.left);
|
||||
ReleaseDC (hdc);
|
||||
printf ("nContX = %d. nContW = %d, rcVis.right = %d, rcVis.left = %d.\n",
|
||||
sled->nContX, sled->nContW, sled->rcVis.right, sled->rcVis.left);
|
||||
@@ -849,7 +849,7 @@ static void set_line_width (HWND hWnd, PBIDISLEDITDATA sled)
|
||||
SelectFont (hdc, GetWindowFont(hWnd));
|
||||
update_achar_info(hWnd, sled);
|
||||
|
||||
GetGlyphsExtent (hdc, ACHARS, ACHARSLEN, &achars_size);
|
||||
GetACharsExtent (hdc, ACHARS, ACHARSLEN, &achars_size);
|
||||
ReleaseDC (hdc);
|
||||
|
||||
if (achars_size.cx > sled->nVisW)
|
||||
@@ -944,7 +944,7 @@ static void del_selected_text (HWND hWnd, PBIDISLEDITDATA sled)
|
||||
end_byte_index = MAX (s, e);
|
||||
|
||||
|
||||
_MG_PRINTF("delete: sel_achar-[%d,%d], sel_byte = [%d, %d]\n",
|
||||
_DBG_PRINTF("delete: sel_achar-[%d,%d], sel_byte = [%d, %d]\n",
|
||||
sled->selStart, sled->selEnd,
|
||||
start_byte_index, end_byte_index);
|
||||
|
||||
@@ -1243,15 +1243,15 @@ get_insert_pos (PLOGFONT logfont, PBIDISLEDITDATA sled, char *newtext,
|
||||
static void print_text(PBIDISLEDITDATA sled)
|
||||
{
|
||||
int i;
|
||||
_MG_PRINTF("sled->text = [");
|
||||
_DBG_PRINTF("sled->text = [");
|
||||
for (i=0; i<TEXTLEN; i++)
|
||||
_MG_PRINTF("%c", TEXT[i]);
|
||||
_MG_PRINTF ("]\n");
|
||||
_DBG_PRINTF("%c", TEXT[i]);
|
||||
_DBG_PRINTF ("]\n");
|
||||
/* output hexstring.*/
|
||||
_MG_PRINTF("sled->text = [");
|
||||
_DBG_PRINTF("sled->text = [");
|
||||
for (i=0; i<TEXTLEN; i++)
|
||||
_MG_PRINTF("%0x ", TEXT[i]);
|
||||
_MG_PRINTF ("]\n");
|
||||
_DBG_PRINTF("%0x ", TEXT[i]);
|
||||
_DBG_PRINTF ("]\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1336,12 +1336,12 @@ sleInsertText (HWND hWnd, PBIDISLEDITDATA sled, char *newtext,
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
int i = 0;
|
||||
_MG_PRINTF ("string = %s.\n", TEXT);
|
||||
_MG_PRINTF ("editPos = %d.\n", sled->editPos);
|
||||
_DBG_PRINTF ("string = %s.\n", TEXT);
|
||||
_DBG_PRINTF ("editPos = %d.\n", sled->editPos);
|
||||
for (i = 0; i < sled->achar_content.achars_len; i++) {
|
||||
_MG_PRINTF ("map[%d] = %d,", i,
|
||||
_DBG_PRINTF ("map[%d] = %d,", i,
|
||||
sled->achar_content.achar_map[i].byte_index);
|
||||
_MG_PRINTF ("\n");
|
||||
_DBG_PRINTF ("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2281,7 +2281,7 @@ static void sledit_refresh_caret (HWND hWnd, PBIDISLEDITDATA sled, BOOL bInited)
|
||||
return;
|
||||
|
||||
hdc = GetClientDC (hWnd);
|
||||
outchar = GetGlyphsExtentPoint (hdc, ACHARS, ACHARSLEN, 0, &achars_size);
|
||||
outchar = GetACharsExtentPoint (hdc, ACHARS, ACHARSLEN, 0, &achars_size);
|
||||
ReleaseDC (hdc);
|
||||
|
||||
if (bInited) {
|
||||
@@ -2488,7 +2488,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
unsigned char charBuffer [4];
|
||||
int chars;
|
||||
|
||||
_MG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
|
||||
_DBG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
|
||||
|
||||
if (dwStyle & ES_READONLY)
|
||||
return 0;
|
||||
|
||||
@@ -352,7 +352,7 @@ static LRESULT ComboBoxCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
DWORD list_style, edit_style;
|
||||
|
||||
if (!(pData = calloc (1, sizeof (COMBOBOXDATA)))) {
|
||||
_MG_PRINTF ("CONTROL>ComboBox: Create control failure!\n");
|
||||
_WRN_PRINTF ("Create control failure!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -565,7 +565,7 @@ static void lstOnDrawSListBoxItems (HWND hWnd, HDC hdc,
|
||||
|
||||
if (!pWin->we_rdr)
|
||||
{
|
||||
_MG_PRINTF ("CONTROL>ListBox: NULL LFRDR.\n");
|
||||
_WRN_PRINTF ("NULL LFRDR.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ static int lstSelectItem (HWND hwnd, PLISTBOXDATA pData, int newSel)
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (!newItem)
|
||||
_MG_PRINTF ("CONTROL>ListBox: return value of lstGetItem is NULL. \n");
|
||||
_WRN_PRINTF ("return value of lstGetItem is NULL.");
|
||||
#endif
|
||||
|
||||
if (GetWindowStyle (hwnd) & LBS_MULTIPLESEL) {
|
||||
|
||||
@@ -104,7 +104,7 @@ ProgressBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
case MSG_CREATE:
|
||||
if (!(pData = malloc (sizeof (PROGRESSDATA)))) {
|
||||
_MG_PRINTF ("CONTROL>ProgressBar: Create control failure!\n");
|
||||
_WRN_PRINTF ("Create control failure!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
+30
-31
File diff suppressed because it is too large
Load Diff
@@ -916,7 +916,7 @@ textdoc_insert_text (TextDoc *txtdoc, const char* newtext, int len)
|
||||
/* insert last strings */
|
||||
/* FIXME */
|
||||
if (!nextnode) {
|
||||
_MG_PRINTF ("CONTROL>TextEdit: (Warning) nextnode is NULL!\n");
|
||||
_WRN_PRINTF ("nextnode is NULL!");
|
||||
/* set_current_node (txtdoc, LASTNODE(txtdoc), FALSE, TRUE); */
|
||||
}
|
||||
else {
|
||||
@@ -1446,7 +1446,7 @@ static int get_line_nr (HWND hWnd, PTEDATA ptedata, TextNode *node, int indent)
|
||||
HDC hdc;
|
||||
|
||||
if (!node) {
|
||||
_MG_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to get_line_nr\n");
|
||||
_WRN_PRINTF ("pass NULL text node to get_line_nr");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1571,7 +1571,7 @@ set_line_width (HWND hWnd, PTEDATA ptedata, TextNode *node, int indent)
|
||||
HDC hdc;
|
||||
|
||||
if (!node) {
|
||||
_MG_PRINTF ("CONTROL>TextEdit: (Warning) pass NULL text node to set_line_width\n");
|
||||
_WRN_PRINTF ("pass NULL text node to set_line_width");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ static void TrackBarOnDraw (HWND hwnd, HDC hdc, TRACKBARDATA* pData, DWORD dwSty
|
||||
|
||||
win_rdr = GetWindowInfo(hwnd)->we_rdr;
|
||||
if (!win_rdr) {
|
||||
_MG_PRINTF ("CONTROL>TrackBar: window renderer is NULL.\n");
|
||||
_WRN_PRINTF ("window renderer is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ static LRESULT TrackBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
case MSG_CREATE:
|
||||
if (!(pData = malloc (sizeof (TRACKBARDATA)))) {
|
||||
_MG_PRINTF ("CONTROL>TrackBar: Create control failure!\n");
|
||||
_WRN_PRINTF ("Create control failure!");
|
||||
return -1;
|
||||
}
|
||||
pData->nMax = 10;
|
||||
|
||||
+18
-18
@@ -216,7 +216,7 @@ static int LWZReadByte (MG_RWops *area, int flag, int input_code_size)
|
||||
while (code >= clear_code) {
|
||||
*sp++ = table[1][code];
|
||||
if (code == table[0][code]) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: circular table entry\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: circular table entry\n");
|
||||
return -1;
|
||||
}
|
||||
code = table[0][code];
|
||||
@@ -259,7 +259,7 @@ static int GetCode(MG_RWops *area, int code_size, int flag)
|
||||
if ((curbit + code_size) >= lastbit) {
|
||||
if (done) {
|
||||
if (curbit >= lastbit)
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: bad decode\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: bad decode\n");
|
||||
return -1;
|
||||
}
|
||||
buf[0] = buf[last_byte - 2];
|
||||
@@ -362,7 +362,7 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen)
|
||||
version [3] = '\0';
|
||||
|
||||
if (strcmp ((const char*)version, "87a") != 0 && strcmp ((const char*)version, "89a") != 0) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: GIF version number not 87a or 89a.\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: GIF version number not 87a or 89a.\n");
|
||||
return -1; /* image loading error*/
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen)
|
||||
GifScreen->disposal = 0;
|
||||
|
||||
if (!ReadOK (area, buf, 7)) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: bad screen descriptor\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: bad screen descriptor\n");
|
||||
return -1; /* image loading error*/
|
||||
}
|
||||
GifScreen->Width = LM_to_uint (buf[0], buf[1]);
|
||||
@@ -384,10 +384,10 @@ static int ReadGIFGlobal (MG_RWops *area, GIFSCREEN* GifScreen)
|
||||
GifScreen->AspectRatio = buf[6];
|
||||
|
||||
if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: have global colormap: %d\n",
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: have global colormap: %d\n",
|
||||
GifScreen->Background);
|
||||
if (ReadColorMap (area, GifScreen->BitPixel, GifScreen->ColorMap)) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: bad global colormap\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: bad global colormap\n");
|
||||
return -1; /* image loading error*/
|
||||
}
|
||||
}
|
||||
@@ -399,7 +399,7 @@ static int ReadImageDesc (MG_RWops *area, IMAGEDESC* ImageDesc, GIFSCREEN* GifSc
|
||||
{
|
||||
unsigned char buf[16];
|
||||
if (!ReadOK (area, buf, 9)) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: bad image size\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: bad image size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -414,9 +414,9 @@ static int ReadImageDesc (MG_RWops *area, IMAGEDESC* ImageDesc, GIFSCREEN* GifSc
|
||||
ImageDesc->interlace = BitSet(buf[8], INTERLACE);
|
||||
|
||||
if (ImageDesc->haveColorMap) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: have local colormap\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: have local colormap\n");
|
||||
if (ReadColorMap (area, ImageDesc->bitPixel, ImageDesc->ColorMap) < 0) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: bad local colormap\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: bad local colormap\n");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -437,12 +437,12 @@ static int ReadImage (MG_RWops* area, MYBITMAP* bmp, IMAGEDESC* ImageDesc, GIFSC
|
||||
* initialize the compression routines
|
||||
*/
|
||||
if (!ReadOK (area, &c, 1)) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: eof on image data\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: eof on image data\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (LWZReadByte (area, TRUE, c) < 0) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: error reading image\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: error reading image\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -549,11 +549,11 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area)
|
||||
anim->bk.a = 0;
|
||||
}
|
||||
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: Background: %d, %d, %d.\n",
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: Background: %d, %d, %d.\n",
|
||||
anim->bk.r, anim->bk.g, anim->bk.b);
|
||||
|
||||
if ((ok = ReadOK (area, &c, 1)) == 0) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -561,11 +561,11 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area)
|
||||
switch (c) {
|
||||
case '!':
|
||||
if ( (ok = ReadOK (area, &c, 1)) == 0) {
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: EOF on image data\n");
|
||||
goto error;
|
||||
}
|
||||
DoExtension (area, c, &GifScreen);
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: Extension info: %d, %d, %d, %d, %d, %d\n",
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: Extension info: %d, %d, %d, %d, %d, %d\n",
|
||||
GifScreen.Width, GifScreen.Height,
|
||||
GifScreen.AspectRatio, GifScreen.delayTime,
|
||||
GifScreen.disposal, GifScreen.transparent);
|
||||
@@ -579,7 +579,7 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area)
|
||||
if (ReadImage (area, &mybmp, &ImageDesc, &GifScreen, 0) < 0)
|
||||
goto error;
|
||||
}
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: Image Descriptor: %d, %d, %d, %d, %d\n",
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: Image Descriptor: %d, %d, %d, %d, %d\n",
|
||||
ImageDesc.Top, ImageDesc.Left,
|
||||
ImageDesc.Width, ImageDesc.Height,
|
||||
ImageDesc.haveColorMap);
|
||||
@@ -595,14 +595,14 @@ ANIMATION* CreateAnimationFromGIF89a (HDC hdc, MG_RWops* area)
|
||||
frame->width = mybmp.w;
|
||||
frame->height = mybmp.h;
|
||||
frame->delay_time = (GifScreen.delayTime>10)?GifScreen.delayTime:10;
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: frame info: %d, %d, %d, %d\n",
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: frame info: %d, %d, %d, %d\n",
|
||||
frame->off_x, frame->off_y, frame->delay_time,
|
||||
GifScreen.transparent);
|
||||
|
||||
if ((frame->mem_dc = CreateMemDCFromMyBitmap (&mybmp, ImageDesc.ColorMap)) == 0) {
|
||||
free (mybmp.bits);
|
||||
free (frame);
|
||||
_MG_PRINTF ("EX_CTRL>GIF89a: Error when expand frame bitmap.\n");
|
||||
_WRN_PRINTF ("EX_CTRL>GIF89a: Error when expand frame bitmap.\n");
|
||||
goto error;
|
||||
}
|
||||
frame->bits = mybmp.bits;
|
||||
|
||||
@@ -1108,7 +1108,7 @@ void GridCellTypeNumber_set_text_value(gvGridCellData* cell, int row, int col, c
|
||||
if (INF[0] != 'I' && INF[0] != 'i')
|
||||
cell->data.number.num = number;
|
||||
else
|
||||
_MG_PRINTF ("EX_CTRL>Grid: The inputed number is too big!\n");
|
||||
_WRN_PRINTF ("EX_CTRL>Grid: The inputed number is too big!\n");
|
||||
}
|
||||
|
||||
double GridCellTypeNumber_get_double_value(gvGridCellData* cell, int row, int col)
|
||||
|
||||
+27
-7
@@ -2,26 +2,46 @@ SUBDIRS = in-core
|
||||
|
||||
noinst_LTLIBRARIES = libfont.la
|
||||
|
||||
SRC_FILES = charset.c charset-arabic.c charset-bidi.c \
|
||||
SRC_FILES = charset.c charset-arabic.c legacy-bidi.c charset-unicode.c \
|
||||
unicode-comp.c unicode-script.c language-code.c \
|
||||
sysfont.c logfont.c devfont.c fontname.c \
|
||||
rawbitmap.c varbitmap.c qpf.c upf.c \
|
||||
nullfont.c rawbitmap.c varbitmap.c qpf.c upf.c \
|
||||
fontcache.c freetype2.c font-engines.c\
|
||||
gbunimap.c gbkunimap.c gb18030unimap.c big5unimap.c \
|
||||
ujisunimap.c sjisunimap.c euckrunimap.c \
|
||||
textops.c mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
|
||||
textops.c \
|
||||
mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
|
||||
bitmapfont.c scripteasy.c \
|
||||
unicode-emoji.c
|
||||
unicode-emoji.c unicode-vop.c \
|
||||
unicode-bidi.c \
|
||||
unicode-break.c unicode-break-arabic.c unicode-break-indic.c unicode-break-thai.c \
|
||||
unicode-joining-types.c unicode-joining.c unicode-shape.c \
|
||||
unicode-shape-arabic.c harzbuff-minigui-funcs.c \
|
||||
unicode-iterators.c
|
||||
|
||||
HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype2.h qpf.h se_minigui.h \
|
||||
upf.h bitmapfont.h unicode-bidi-tables.h \
|
||||
unicode-tables.h unicode-break.h unicode-decomp.h unicode-comp.h unicode-emoji-table.h
|
||||
unicode-tables.h unicode-break-tables.h unicode-script-table.h \
|
||||
unicode-decomp.h unicode-comp.h \
|
||||
unicode-emoji-tables.h \
|
||||
legacy-bidi-tables.inc \
|
||||
unicode-bidi.h unicode-vop-table.inc \
|
||||
unicode-joining-types-list.inc \
|
||||
unicode-joining-type-table.inc \
|
||||
unicode-arabic-shaping-table.inc \
|
||||
unicode-arabic-misc-table.inc \
|
||||
unicode-bidi-bidi-types-list.inc \
|
||||
unicode-bidi-bidi-type-table.inc \
|
||||
unicode-bidi-brackets-table.inc \
|
||||
unicode-bidi-brackets-type-table.inc \
|
||||
unicode-bidi-mirroring-table.inc \
|
||||
script-language-table.inc \
|
||||
emoji_presentation_scanner.inc
|
||||
|
||||
EXTRA_DIST = convgbmap.c jisunimap.c $(SRC_FILES) $(HDR_FILES) \
|
||||
makefile.ng makefile.msvc
|
||||
|
||||
# AM_CPPFLAGS = $(FT1_INC_DIR) $(FT2_INC_DIR)
|
||||
AM_CPPFLAGS = $(FT2_INC_DIR)
|
||||
AM_CPPFLAGS = $(FT2_INC_DIR) $(HB_INC_DIR)
|
||||
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||
|
||||
libfont_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
|
||||
|
||||
@@ -274,7 +274,7 @@ get_glyph_prbitmap (LOGFONT* logfont, DEVFONT* devfont,
|
||||
bmp->bmHeight = 0;
|
||||
bmp->bmPitch = 0;
|
||||
|
||||
_MG_PRINTF ("FONT>Bitmap: "
|
||||
_DBG_PRINTF ("FONT>Bitmap: "
|
||||
"Glyph %d does not exist and is replaced with default glyph. \n",
|
||||
glyph_value);
|
||||
return 1;
|
||||
|
||||
@@ -176,6 +176,8 @@ static unsigned short iso8859_68x_unicode_map [] =
|
||||
|
||||
static Uchar32 iso8859_6_conv_to_uc32 (Achar32 chv)
|
||||
{
|
||||
chv = REAL_ACHAR(chv);
|
||||
|
||||
if (chv < 0x81)
|
||||
return (Achar32) (chv);
|
||||
else if (chv <= MAX_GLYPH_VALUE )
|
||||
@@ -456,10 +458,10 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
|
||||
|
||||
static unsigned int iso8859_6_char_type (Achar32 chv)
|
||||
{
|
||||
unsigned int ch_type = MCHAR_TYPE_UNKNOWN;
|
||||
unsigned int ch_type = ACHAR_BASIC_UNKNOWN;
|
||||
|
||||
if (is_arabic_char_vowel (chv)) { /* is vowel */
|
||||
ch_type = MCHAR_TYPE_VOWEL;
|
||||
ch_type = ACHAR_BASIC_VOWEL;
|
||||
}
|
||||
else{
|
||||
ch_type = sb_char_type (chv);
|
||||
@@ -468,7 +470,8 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
|
||||
return ch_type;
|
||||
}
|
||||
|
||||
static Uint32 __mg_iso8859_68x_type[] = {
|
||||
static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
|
||||
#if 0
|
||||
/*0x00~0x0f*/
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
@@ -504,6 +507,7 @@ static Uint32 __mg_iso8859_68x_type[] = {
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
|
||||
/*0x60~0x6f*/
|
||||
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
@@ -515,6 +519,7 @@ static Uint32 __mg_iso8859_68x_type[] = {
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
|
||||
#endif
|
||||
|
||||
/*0x80~0x8f*/
|
||||
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
|
||||
@@ -586,9 +591,13 @@ static Uint32 __mg_iso8859_68x_type[] = {
|
||||
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
|
||||
};
|
||||
|
||||
static unsigned int iso8859_6_bidi_char_type (Achar32 chv)
|
||||
static BidiType iso8859_6_bidi_char_type (Achar32 chv)
|
||||
{
|
||||
return __mg_iso8859_68x_type [chv];
|
||||
chv = REAL_ACHAR(chv);
|
||||
if (chv > 0x7F)
|
||||
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
|
||||
else
|
||||
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
|
||||
}
|
||||
|
||||
static int get_table_index(Uint8 c)
|
||||
@@ -847,7 +856,7 @@ static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
|
||||
|
||||
static CHARSETOPS CharsetOps_iso8859_6 = {
|
||||
256,
|
||||
1,
|
||||
3,
|
||||
FONT_CHARSET_ISO8859_6,
|
||||
0,
|
||||
iso8859_6_len_first_char,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+67
-1398
File diff suppressed because it is too large
Load Diff
+119
-20
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -31,15 +31,18 @@
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
typedef struct {
|
||||
char* type;
|
||||
FONTOPS* ops;
|
||||
char* type;
|
||||
FONTOPS* ops;
|
||||
}FONTOPS_INFO;
|
||||
|
||||
extern FONTOPS __mg_null_font_ops;
|
||||
|
||||
#ifdef _MGFONT_RBF
|
||||
extern FONTOPS __mg_rbf_ops;
|
||||
#endif
|
||||
@@ -61,6 +64,7 @@ extern FONTOPS __mg_ttf_ops;
|
||||
#endif
|
||||
|
||||
FONTOPS_INFO __mg_fontops_infos[] = {
|
||||
{FONT_TYPE_NAME_BITMAP_NUF, &__mg_null_font_ops},
|
||||
#ifdef _MGFONT_RBF
|
||||
{FONT_TYPE_NAME_BITMAP_RAW, &__mg_rbf_ops},
|
||||
#endif
|
||||
|
||||
+7
-18
@@ -43,20 +43,11 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGFONT_TTF_CACHE
|
||||
#if defined(_MGFONT_FT2) && defined(_MGFONT_TTF_CACHE)
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#ifdef _MGFONT_TTF
|
||||
#include <freetype/freetype.h>
|
||||
#include <freetype/ftxkern.h>
|
||||
#include <freetype/ftnameid.h>
|
||||
#include <freetype/ftxcmap.h>
|
||||
#include <freetype/ftxwidth.h>
|
||||
#include "freetype.h"
|
||||
#else
|
||||
#include "freetype2.h"
|
||||
#endif
|
||||
|
||||
typedef struct _MemBlk {
|
||||
void *data;
|
||||
@@ -378,7 +369,7 @@ AppendBlk(FontCache *cache, MemBlk *blk, int key)
|
||||
*size : if found the data, how long is the data(return val)
|
||||
reutrn = pointer to the data */
|
||||
TTFCACHEINFO *
|
||||
__mg_ttc_search(HCACHE hCache, Uchar32 unicode, int *size)
|
||||
__mg_ttc_search(HCACHE hCache, Glyph32 gv, int *size)
|
||||
{
|
||||
int key;
|
||||
CacheQueueNode *ca;
|
||||
@@ -388,7 +379,7 @@ __mg_ttc_search(HCACHE hCache, Uchar32 unicode, int *size)
|
||||
return NULL;
|
||||
}
|
||||
ca = (CacheQueueNode *)(hCache);
|
||||
key = ca->cache.makeHashKeyFunc(unicode);
|
||||
key = ca->cache.makeHashKeyFunc(gv);
|
||||
if (key > (ca->cache.nDir - 1)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -397,7 +388,7 @@ __mg_ttc_search(HCACHE hCache, Uchar32 unicode, int *size)
|
||||
for ( ; blk != &(ca->cache.hashDir[key].hashHead);
|
||||
blk = blk->hashNext) {
|
||||
TTFCACHEINFO* tci = (TTFCACHEINFO*)blk->data;
|
||||
if (tci->unicode == unicode) {
|
||||
if (tci->glyph_code == gv) {
|
||||
/* If found the blk, we should pick off it
|
||||
and link it at the end of LRU-q */
|
||||
*size = blk->len;
|
||||
@@ -433,7 +424,7 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
|
||||
if (ca->cache.blkSize < size) {
|
||||
return -1;
|
||||
}
|
||||
key = ca->cache.makeHashKeyFunc(data->unicode);
|
||||
key = ca->cache.makeHashKeyFunc(data->glyph_code);
|
||||
|
||||
/* pick off a block from lru queue */
|
||||
if ((blk = PickOffBlk(&ca->cache)) == NULL) {
|
||||
@@ -695,7 +686,6 @@ void
|
||||
__mg_ttc_dump_cacheinfo(TTFCACHEINFO *ca)
|
||||
{
|
||||
DP(("Dump TTFCACHEINFO %p...\n", ca));
|
||||
DP(("cacheInfo->unicode = %d\n", ca->unicode));
|
||||
DP(("cacheInfo->glyph_code = %d\n", ca->glyph_code));
|
||||
|
||||
DP(("cacheInfo->cur_xmin = %d, cacheInfo->cur_ymin = %d\n",
|
||||
@@ -714,7 +704,6 @@ void
|
||||
__mg_ttc_dump_instance(TTFINSTANCEINFO *in)
|
||||
{
|
||||
DP(("Dump TTFINSTANCEINFO %p...\n", in));
|
||||
DP(("Instance->cur_unicode = %d\n", in->cur_unicode));
|
||||
DP(("Instance->cur_glyph_code = %d\n", in->cur_glyph_code));
|
||||
DP(("Instance->outline(addr) = %p\n", &in->cur_outline));
|
||||
DP(("Instance->cur_xmin = %d, Instance->cur_ymin = %d\n",
|
||||
@@ -731,5 +720,5 @@ __mg_ttc_dump_instance(TTFINSTANCEINFO *in)
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* _MGFONT_TTF_CACHE */
|
||||
#endif /* defined(_MGFONT_FT2) && defined(_MGFONT_TTF_CACHE) */
|
||||
|
||||
|
||||
+50
-4
@@ -44,8 +44,6 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
@@ -117,7 +115,7 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
|
||||
if (*(++family_part) == '\0')
|
||||
return FALSE;
|
||||
|
||||
while (family_part [i] && i <= LEN_LOGFONT_FAMILY_FILED) {
|
||||
while (family_part [i] && i <= LEN_LOGFONT_FAMILY_FIELD) {
|
||||
if (family_part [i] == '-'/* || family_part [i] == ',' */) {
|
||||
family [i] = '\0';
|
||||
break;
|
||||
@@ -185,7 +183,7 @@ static const char *my_strstr(const char *haystack, const char *needle)
|
||||
BOOL fontDoesMatchFamily (const char* name, const char* family)
|
||||
{
|
||||
// make sure there is a redundant space for the head and tail characters.
|
||||
char family_part[LEN_LOGFONT_FAMILY_FILED + 3];
|
||||
char family_part[LEN_LOGFONT_FAMILY_FIELD + 3];
|
||||
char family_request[LEN_LOGFONT_NAME_FIELD + 3];
|
||||
int i;
|
||||
size_t len;
|
||||
@@ -474,6 +472,54 @@ int fontGetWidthFromName (const char* name)
|
||||
return atoi (width);
|
||||
}
|
||||
|
||||
/* Since 3.4.0; only for LOGFONT name */
|
||||
char fontGetOrientFromName (const char* name)
|
||||
{
|
||||
int i;
|
||||
const char* orient_part = name;
|
||||
char orient [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
|
||||
for (i = 0; i < NR_LOOP_FOR_ORIENT; i++) {
|
||||
if ((orient_part = strchr (orient_part, '-')) == NULL)
|
||||
return FONT_ORIENT_UPRIGHT;
|
||||
|
||||
if (*(++orient_part) == '\0')
|
||||
return FONT_ORIENT_UPRIGHT;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (orient_part [i]) {
|
||||
if (orient_part [i] == '-') {
|
||||
orient [i] = '\0';
|
||||
break;
|
||||
}
|
||||
|
||||
orient [i] = orient_part [i];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (orient_part [i] == '\0')
|
||||
return FONT_ORIENT_UPRIGHT;
|
||||
|
||||
return orient[0];
|
||||
}
|
||||
|
||||
int fontGetOrientPosFromName (const char* name)
|
||||
{
|
||||
int i;
|
||||
const char* orient_part = name;
|
||||
|
||||
for (i = 0; i < NR_LOOP_FOR_ORIENT; i++) {
|
||||
if ((orient_part = strchr (orient_part, '-')) == NULL)
|
||||
return -1;
|
||||
|
||||
if (*(++orient_part) == '\0')
|
||||
return -1;
|
||||
}
|
||||
|
||||
return orient_part - name;
|
||||
}
|
||||
|
||||
int fontGetHeightFromName (const char* name)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -76,7 +76,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
|
||||
/* Load face */
|
||||
if (TT_Open_Face (ttf_engine, file_name, &ttf_glyph_info->face) != TT_Err_Ok) {
|
||||
_MG_PRINTF ("FONT>FT1: TT_Open_Face error.\n");
|
||||
_WRN_PRINTF ("FONT>FT1: TT_Open_Face error.\n");
|
||||
goto error_after_create_info;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
}
|
||||
|
||||
if (i == n) {
|
||||
_MG_PRINTF ("FONT>FT1: no unicode map table\n");
|
||||
_WRN_PRINTF ("FONT>FT1: no unicode map table\n");
|
||||
goto error_after_create_face;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
= (properties.num_Glyphs > 255) ? 255 : properties.num_Glyphs - 1;
|
||||
|
||||
if (TT_New_Glyph (ttf_glyph_info->face, &ttf_glyph_info->glyph) != TT_Err_Ok) {
|
||||
_MG_PRINTF ("FONT>FT1: TT_New_Glyph error.\n");
|
||||
_WRN_PRINTF ("FONT>FT1: TT_New_Glyph error.\n");
|
||||
goto error_after_create_face;
|
||||
}
|
||||
ttf_inst_info->ttf_glyph_info = ttf_glyph_info;
|
||||
@@ -820,7 +820,7 @@ BOOL font_InitFreetypeLibrary (void)
|
||||
|
||||
#ifdef _MGFONT_TTF_CACHE
|
||||
if (__mg_ttc_sys_init(_MGMAX_TTF_CACHE, _MGTTF_CACHE_SIZE * 1024)) {
|
||||
_MG_PRINTF ("FONT>FT1: init ttf cache sys failed\n");
|
||||
_WRN_PRINTF ("FONT>FT1: init ttf cache sys failed\n");
|
||||
goto error_library;
|
||||
}
|
||||
#endif
|
||||
|
||||
+238
-199
File diff suppressed because it is too large
Load Diff
+23
-15
@@ -40,8 +40,6 @@
|
||||
#ifndef GUI_FREETYP2_H
|
||||
#define GUI_FREETYP2_H
|
||||
|
||||
#undef TTF_DBG
|
||||
|
||||
#ifndef TTF_DBG
|
||||
#define DP(x)
|
||||
#else
|
||||
@@ -72,7 +70,7 @@ extern "C" {
|
||||
|
||||
#ifdef _MGFONT_TTF_CACHE
|
||||
typedef void* HCACHE;
|
||||
typedef int (* MakeHashKeyFunc)(Uchar32 unicode);
|
||||
typedef int (* MakeHashKeyFunc)(Glyph32 gv);
|
||||
#endif
|
||||
|
||||
typedef struct tagFTFACEINFO {
|
||||
@@ -80,9 +78,8 @@ typedef struct tagFTFACEINFO {
|
||||
char* filepathname;
|
||||
int face_index;
|
||||
int cmap_index;
|
||||
#else
|
||||
FT_Face face;
|
||||
#endif
|
||||
FT_Face face;
|
||||
BOOL valid;
|
||||
} FTFACEINFO, *PFTFACEINFO;
|
||||
|
||||
@@ -92,9 +89,8 @@ typedef struct tagFTINSTANCEINFO {
|
||||
FTC_ImageTypeRec image_type;
|
||||
FT_Int glyph_done;
|
||||
HCACHE cache;
|
||||
#else
|
||||
FT_Size size;
|
||||
#endif
|
||||
FT_Size size;
|
||||
FT_Matrix matrix;
|
||||
FT_Glyph glyph;
|
||||
int rotation;
|
||||
@@ -108,11 +104,12 @@ typedef struct tagFTINSTANCEINFO {
|
||||
int ascent;
|
||||
int descent;
|
||||
|
||||
FT_Bool use_kerning; /*FT_HAS_KERNING(face)*/
|
||||
FT_Vector delta;
|
||||
int is_index_old;
|
||||
FT_Bool use_kerning;
|
||||
FT_UInt cur_index;
|
||||
#if 0
|
||||
int is_index_old;
|
||||
FT_UInt prev_index;
|
||||
#endif
|
||||
|
||||
FT_LcdFilter ft_lcdfilter;
|
||||
} FTINSTANCEINFO, *PFTINSTANCEINFO;
|
||||
@@ -121,13 +118,20 @@ typedef struct tagFTINSTANCEINFO {
|
||||
|
||||
#define _TTF_HASH_NDIR 37
|
||||
|
||||
#define CACHE_VALID_ADVANCE 0x01
|
||||
#define CACHE_VALID_BBOX 0x02
|
||||
#define CACHE_VALID_BITMAP 0x04
|
||||
|
||||
typedef struct tagTTFCACHEINFO {
|
||||
Uchar32 unicode;
|
||||
FT_UInt glyph_code;
|
||||
Uint32 valid_advance:1;
|
||||
Uint32 valid_bbox:1;
|
||||
Uint32 valid_bitmap:1;
|
||||
Uint32 reserved_flags:28;
|
||||
|
||||
FT_Vector advance;
|
||||
FT_BBox bbox;
|
||||
FT_Vector delta;
|
||||
int flag;
|
||||
|
||||
int pitch;
|
||||
int width;
|
||||
int height;
|
||||
@@ -144,10 +148,14 @@ extern int __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size);
|
||||
extern void __mg_ttc_release(HCACHE hCache);
|
||||
extern int __mg_ttc_sys_init(int maxCache, int cacheSize);
|
||||
extern void __mg_ttc_sys_deinit(void);
|
||||
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache,
|
||||
Uchar32 unicode, int *size);
|
||||
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache, Glyph32 gv, int *size);
|
||||
extern void __mg_ttc_refer(HCACHE hCache);
|
||||
|
||||
#ifdef _MGCOMPLEX_SCRIPTS
|
||||
extern void __mg_init_harzbuff_funcs(void);
|
||||
extern void __mg_term_harzbuff_funcs(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** harzbuff-minigui-funcs.c:
|
||||
**
|
||||
** Functions for using HarfBuzz with the MiniGUI to provide Unicode data.
|
||||
**
|
||||
** Create by WEI Yongming at 2019/03/14
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#if defined(_MGCHARSET_UNICODE) && defined(_MGCOMPLEX_SCRIPTS)
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include <hb.h>
|
||||
|
||||
static hb_unicode_combining_class_t
|
||||
hb_minigui_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t unicode,
|
||||
void *user_data)
|
||||
|
||||
{
|
||||
return (hb_unicode_combining_class_t) UCharCombiningClass (unicode);
|
||||
}
|
||||
|
||||
static hb_unicode_general_category_t
|
||||
hb_minigui_unicode_general_category (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t unicode,
|
||||
void *user_data)
|
||||
{
|
||||
/* hb_unicode_general_category_t and GUnicodeType are identical */
|
||||
return (hb_unicode_general_category_t) UCharGetCategory (unicode);
|
||||
}
|
||||
|
||||
static hb_codepoint_t
|
||||
hb_minigui_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t unicode,
|
||||
void *user_data)
|
||||
{
|
||||
UCharGetMirror (unicode, &unicode);
|
||||
return unicode;
|
||||
}
|
||||
|
||||
static hb_script_t
|
||||
hb_minigui_unicode_script (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t unicode,
|
||||
void *user_data)
|
||||
{
|
||||
return ScriptTypeToISO15924 (UCharGetScriptType(unicode));
|
||||
}
|
||||
|
||||
static hb_bool_t
|
||||
hb_minigui_unicode_compose (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t a,
|
||||
hb_codepoint_t b,
|
||||
hb_codepoint_t *ab,
|
||||
void *user_data)
|
||||
{
|
||||
return UCharCompose (a, b, ab);
|
||||
}
|
||||
|
||||
static hb_bool_t
|
||||
hb_minigui_unicode_decompose (hb_unicode_funcs_t *ufuncs,
|
||||
hb_codepoint_t ab,
|
||||
hb_codepoint_t *a,
|
||||
hb_codepoint_t *b,
|
||||
void *user_data)
|
||||
{
|
||||
return UCharDecompose(ab, a, b);
|
||||
}
|
||||
|
||||
static hb_unicode_funcs_t *funcs;
|
||||
static hb_unicode_funcs_t *get_unicode_funcs(void)
|
||||
{
|
||||
funcs = hb_unicode_funcs_create (NULL);
|
||||
|
||||
hb_unicode_funcs_set_combining_class_func (funcs,
|
||||
hb_minigui_unicode_combining_class, NULL, NULL);
|
||||
hb_unicode_funcs_set_general_category_func (funcs,
|
||||
hb_minigui_unicode_general_category, NULL, NULL);
|
||||
hb_unicode_funcs_set_mirroring_func (funcs,
|
||||
hb_minigui_unicode_mirroring, NULL, NULL);
|
||||
hb_unicode_funcs_set_script_func (funcs,
|
||||
hb_minigui_unicode_script, NULL, NULL);
|
||||
hb_unicode_funcs_set_compose_func (funcs,
|
||||
hb_minigui_unicode_compose, NULL, NULL);
|
||||
hb_unicode_funcs_set_decompose_func (funcs,
|
||||
hb_minigui_unicode_decompose, NULL, NULL);
|
||||
|
||||
hb_unicode_funcs_make_immutable (funcs);
|
||||
|
||||
return funcs;
|
||||
}
|
||||
|
||||
typedef hb_unicode_funcs_t *(*hb_get_unicode_funcs) (void);
|
||||
extern hb_get_unicode_funcs __hb_extern_get_unicode_funcs;
|
||||
|
||||
void __mg_init_harzbuff_funcs(void)
|
||||
{
|
||||
_DBG_PRINTF("%s: called\n", __FUNCTION__);
|
||||
__hb_extern_get_unicode_funcs = get_unicode_funcs;
|
||||
}
|
||||
|
||||
void __mg_term_harzbuff_funcs(void)
|
||||
{
|
||||
_DBG_PRINTF("%s: called\n", __FUNCTION__);
|
||||
|
||||
if (funcs) {
|
||||
hb_unicode_funcs_destroy(funcs);
|
||||
}
|
||||
else {
|
||||
_ERR_PRINTF("%s: hb_unicode_funcs_t object is NULL\n",
|
||||
__FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(_MGCHARSET_UNICODE) && defined(_MGCOMPLEX_SCRIPTS) */
|
||||
|
||||
+338
-2
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,85 @@
|
||||
/* == Start of generated table == */
|
||||
/*
|
||||
* The following table is generated by running:
|
||||
*
|
||||
* ./gen-ascii-bidi-tables.py
|
||||
*
|
||||
* on ucd/UnicodeData.txt files with these headers:
|
||||
*
|
||||
* UnicodeData.txt does not have a header.
|
||||
*/
|
||||
|
||||
#ifndef _MGFONT_ISO8859_BIDI_TABLES_H
|
||||
#define _MGFONT_ISO8859_BIDI_TABLES_H
|
||||
|
||||
static const BidiType __mg_iso8859_1_bidi_char_type_map[] =
|
||||
{
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_SS, BIDI_TYPE_BS, BIDI_TYPE_SS,
|
||||
BIDI_TYPE_WS, BIDI_TYPE_BS, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BS, BIDI_TYPE_BS, BIDI_TYPE_BS, BIDI_TYPE_SS,
|
||||
BIDI_TYPE_WS, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ET,
|
||||
BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ES,
|
||||
BIDI_TYPE_CS, BIDI_TYPE_ES, BIDI_TYPE_CS, BIDI_TYPE_CS,
|
||||
BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN,
|
||||
BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_EN,
|
||||
BIDI_TYPE_EN, BIDI_TYPE_EN, BIDI_TYPE_CS, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BS, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
|
||||
BIDI_TYPE_CS, BIDI_TYPE_ON, BIDI_TYPE_ET, BIDI_TYPE_ET,
|
||||
BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_BN, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ET, BIDI_TYPE_ET, BIDI_TYPE_EN, BIDI_TYPE_EN,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_EN, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
|
||||
};
|
||||
|
||||
#endif /* !_MGFONT_ISO8859_BIDI_TABLES_H */
|
||||
|
||||
/* == End of generated table == */
|
||||
File diff suppressed because it is too large
Load Diff
+34
-4
@@ -41,8 +41,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
@@ -125,6 +123,7 @@ static PLOGFONT gdiCreateLogFont (const char* type, const char* family,
|
||||
|
||||
if ((newlf = (PLOGFONT)calloc(sizeof (FONT_RES), 1)) == NULL)
|
||||
return INV_LOGFONT;
|
||||
|
||||
((FONT_RES *)newlf)->key = -1;
|
||||
|
||||
newlf->style = style;
|
||||
@@ -454,10 +453,11 @@ PLOGFONT GUIAPI CreateLogFontEx (const char* type, const char* family,
|
||||
PLOGFONT GUIAPI CreateLogFontByName (const char* font_name)
|
||||
{
|
||||
char type[LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char family[LEN_LOGFONT_FAMILY_FILED + 1];
|
||||
char family[LEN_LOGFONT_FAMILY_FIELD + 1];
|
||||
char charset[LEN_LOGFONT_NAME_FIELD + 1];
|
||||
DWORD style;
|
||||
int height;
|
||||
int rotation;
|
||||
|
||||
if (!fontGetTypeNameFromName (font_name, type) ||
|
||||
!fontGetFamilyFromName (font_name, family) ||
|
||||
@@ -466,7 +466,37 @@ PLOGFONT GUIAPI CreateLogFontByName (const char* font_name)
|
||||
((style = fontGetStyleFromName (font_name)) == 0xFFFFFFFF))
|
||||
return NULL;
|
||||
|
||||
return gdiCreateLogFont (type, family, charset, style, height, 0);
|
||||
switch (fontGetOrientFromName (font_name)) {
|
||||
case FONT_ORIENT_SIDEWAYS:
|
||||
rotation = -900;
|
||||
break;
|
||||
|
||||
case FONT_ORIENT_UPSIDE_DOWN:
|
||||
rotation = 1800;
|
||||
break;
|
||||
|
||||
case FONT_ORIENT_SIDEWAYS_LEFT:
|
||||
rotation = 900;
|
||||
break;
|
||||
|
||||
case FONT_ORIENT_UPRIGHT:
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return gdiCreateLogFont (type, family, charset, style, height, rotation);
|
||||
}
|
||||
|
||||
PLOGFONT GUIAPI CreateLogFontForMChar2UChar(const char* charset)
|
||||
{
|
||||
char my_fontname[LEN_LOGFONT_NAME_FULL + 1];
|
||||
|
||||
memset(my_fontname, 0, LEN_LOGFONT_NAME_FULL + 1);
|
||||
strncpy(my_fontname, "nuf-dummy-rrncnn-U-1-", LEN_LOGFONT_NAME_FULL);
|
||||
strncat(my_fontname, charset, LEN_LOGFONT_NAME_FIELD);
|
||||
|
||||
return CreateLogFontByName(my_fontname);
|
||||
}
|
||||
|
||||
void GUIAPI DestroyLogFont (PLOGFONT logfont)
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** nullfont.c: The Null Font operation set.
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/27
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include "devfont.h"
|
||||
#include "charset.h"
|
||||
#include "fontname.h"
|
||||
|
||||
#define NUF_WIDTH 8
|
||||
#define NUF_HEIGHT 1
|
||||
|
||||
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
}
|
||||
|
||||
static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return NUF_WIDTH;
|
||||
}
|
||||
|
||||
static int get_ave_width (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return NUF_WIDTH;
|
||||
}
|
||||
|
||||
static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return GET_DEVFONT_SCALE (logfont, devfont);
|
||||
}
|
||||
|
||||
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect, int df_slot)
|
||||
{
|
||||
if (df_slot >= 0 && df_slot < MAXNR_DEVFONTS)
|
||||
SET_DEVFONT_SCALE(logfont, df_slot, expect);
|
||||
|
||||
return expect;
|
||||
}
|
||||
|
||||
static int get_font_ascent (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return GET_DEVFONT_SCALE (logfont, devfont);
|
||||
}
|
||||
|
||||
static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||
Glyph32 glyph_value,
|
||||
int* px, int* py, int* pwidth, int* pheight)
|
||||
{
|
||||
int scale = GET_DEVFONT_SCALE (logfont, devfont);
|
||||
|
||||
if (pwidth)
|
||||
*pwidth = NUF_WIDTH;
|
||||
if (pheight)
|
||||
*pheight = NUF_HEIGHT;
|
||||
if (py)
|
||||
*py -= scale;
|
||||
|
||||
return NUF_WIDTH;
|
||||
}
|
||||
|
||||
static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
Glyph32 glyph_value, int* px, int* py)
|
||||
{
|
||||
if (px)
|
||||
*px += NUF_WIDTH;
|
||||
return NUF_WIDTH;
|
||||
}
|
||||
|
||||
static unsigned char null_bitmap = 0x18;
|
||||
|
||||
static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
||||
Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale)
|
||||
{
|
||||
if (sz) {
|
||||
sz->cx = 8;
|
||||
sz->cy = 1;
|
||||
}
|
||||
|
||||
if (pitch)
|
||||
*pitch = 1;
|
||||
|
||||
if (scale)
|
||||
*scale = GET_DEVFONT_SCALE (logfont, devfont);
|
||||
|
||||
return &null_bitmap;
|
||||
}
|
||||
|
||||
static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 gv)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void* load_font_data (DEVFONT* devfont, const char* fontname,
|
||||
const char* filename)
|
||||
{
|
||||
return &null_bitmap;
|
||||
}
|
||||
|
||||
static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
{
|
||||
if (data != &null_bitmap) {
|
||||
_WRN_PRINTF("data is not null_bitmap");
|
||||
}
|
||||
}
|
||||
|
||||
FONTOPS __mg_null_font_ops = {
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
get_font_height,
|
||||
get_font_size,
|
||||
get_font_ascent,
|
||||
get_font_descent,
|
||||
|
||||
is_glyph_existed,
|
||||
get_glyph_advance,
|
||||
get_glyph_bbox,
|
||||
|
||||
get_glyph_monobitmap,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
is_rotatable,
|
||||
load_font_data,
|
||||
unload_font_data
|
||||
};
|
||||
|
||||
+6
-5
@@ -164,14 +164,14 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
qpf_info = (QPFINFO*) calloc (1, sizeof(QPFINFO));
|
||||
|
||||
if (!(fp = fopen (file_name, "rb"))) {
|
||||
_MG_PRINTF ("FONT>QPF: open file error: %s.\n",
|
||||
_WRN_PRINTF ("FONT>QPF: open file error: %s.\n",
|
||||
file_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
file_size = get_opened_file_size (fp);
|
||||
if (file_size == 0) {
|
||||
_MG_PRINTF ("FONT>QPF: empty font file: %s.\n",
|
||||
_WRN_PRINTF ("FONT>QPF: empty font file: %s.\n",
|
||||
file_name);
|
||||
goto error;
|
||||
}
|
||||
@@ -180,14 +180,14 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
|
||||
if ((qpf_info->height
|
||||
= fontGetHeightFromName (font_name)) == -1) {
|
||||
_MG_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n",
|
||||
_WRN_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n",
|
||||
font_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((qpf_info->width
|
||||
= fontGetWidthFromName (font_name)) == -1) {
|
||||
_MG_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n",
|
||||
_WRN_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n",
|
||||
font_name);
|
||||
goto error;
|
||||
}
|
||||
@@ -478,7 +478,8 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
}
|
||||
|
||||
advance = glyph->metrics->advance * GET_DEVFONT_SCALE (logfont, devfont);
|
||||
*px += advance;
|
||||
if (px)
|
||||
*px += advance;
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
@@ -162,8 +162,9 @@ static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect, int df
|
||||
if (logfont->style & FS_OTHER_AUTOSCALE)
|
||||
scale = font_GetBestScaleFactor (height, expect);
|
||||
|
||||
if (df_slot >= 0 && df_slot < MAXNR_DEVFONTS)
|
||||
if (df_slot >= 0 && df_slot < MAXNR_DEVFONTS) {
|
||||
SET_DEVFONT_SCALE (logfont, df_slot, scale);
|
||||
}
|
||||
|
||||
return height * scale;
|
||||
}
|
||||
@@ -239,7 +240,8 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
{
|
||||
int advance = RBFONT_INFO_P (devfont)->width *
|
||||
GET_DEVFONT_SCALE (logfont, devfont);
|
||||
*px += advance;
|
||||
if (px)
|
||||
*px += advance;
|
||||
return advance;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -536,7 +536,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
{
|
||||
seunichar16 wc;
|
||||
SeLogFont selogfont;
|
||||
int x = *px;
|
||||
int x = 0, y = 0;
|
||||
|
||||
glyph_value = REAL_GLYPH(glyph_value);
|
||||
if (devfont->charset_ops->conv_to_uc32)
|
||||
@@ -548,14 +548,17 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
|
||||
lock();
|
||||
|
||||
se_minigui_get_char_advance(&selogfont, wc, px, py);
|
||||
se_minigui_get_char_advance(&selogfont, wc, &x, &y);
|
||||
|
||||
unlock();
|
||||
|
||||
#if SE_MINIGUI_TRACE
|
||||
printf("get_glyph_advance result. wc: 0x%04X x: %d y: %d\n", wc, px ? *px : 0, py ? *py : 0);
|
||||
printf("get_glyph_advance result. wc: 0x%04X x: %d y: %d\n", wc, x, y);
|
||||
#endif
|
||||
return *px - x;
|
||||
|
||||
if (px)
|
||||
*px += x;
|
||||
return x;
|
||||
}
|
||||
|
||||
static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_value)
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ BOOL mg_InitSysFont (void)
|
||||
for (i = 0; i < nr_fonts; i++) {
|
||||
char key [11];
|
||||
char type [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char family [LEN_LOGFONT_FAMILY_FILED + 1];
|
||||
char family [LEN_LOGFONT_FAMILY_FIELD + 1];
|
||||
char style [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char font_name [LEN_DEVFONT_NAME + 1];
|
||||
|
||||
+287
-286
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
/* The tables in this file should all be sorted on their first item. */
|
||||
|
||||
const PairMap mandatory_liga_table[] = {
|
||||
{{0xFEDF, 0xFE82}, 0xFEF5},
|
||||
{{0xFEDF, 0xFE84}, 0xFEF7},
|
||||
{{0xFEDF, 0xFE88}, 0xFEF9},
|
||||
{{0xFEDF, 0xFE8E}, 0xFEFB},
|
||||
{{0xFEE0, 0xFE82}, 0xFEF6},
|
||||
{{0xFEE0, 0xFE84}, 0xFEF8},
|
||||
{{0xFEE0, 0xFE88}, 0xFEFA},
|
||||
{{0xFEE0, 0xFE8E}, 0xFEFC},
|
||||
};
|
||||
|
||||
|
||||
const PairMap console_liga_table[] = {
|
||||
{{0x0640, 0xFC60}, 0xFCF2},
|
||||
{{0x0640, 0xFC61}, 0xFCF3},
|
||||
{{0x0640, 0xFC62}, 0xFCF4},
|
||||
{{0x0640, 0xFE70}, 0xFE71},
|
||||
{{0x0640, 0xFE76}, 0xFE77},
|
||||
{{0x0640, 0xFE78}, 0xFE79},
|
||||
{{0x0640, 0xFE7A}, 0xFE7B},
|
||||
{{0x0640, 0xFE7C}, 0xFE7D},
|
||||
{{0x0640, 0xFE7E}, 0xFE7F},
|
||||
{{0xFBE8, 0x0654}, 0xFE8B},
|
||||
{{0xFBE9, 0x0654}, 0xFE8C},
|
||||
{{0xFBFC, 0x0654}, 0xFE89},
|
||||
{{0xFBFC, 0x0670}, 0xFC5D},
|
||||
{{0xFBFD, 0x0654}, 0xFE8A},
|
||||
{{0xFBFD, 0x0670}, 0xFC90},
|
||||
{{0xFE7C, 0x0670}, 0xFC63},
|
||||
{{0xFE7C, 0xFE72}, 0xFC5E},
|
||||
{{0xFE7C, 0xFE74}, 0xFC5F},
|
||||
{{0xFE7C, 0xFE76}, 0xFC60},
|
||||
{{0xFE7C, 0xFE78}, 0xFC61},
|
||||
{{0xFE7C, 0xFE7A}, 0xFC62},
|
||||
{{0xFE7D, 0xFE76}, 0xFCF2},
|
||||
{{0xFE7D, 0xFE77}, 0xFCF2},
|
||||
{{0xFE7D, 0xFE78}, 0xFCF3},
|
||||
{{0xFE7D, 0xFE79}, 0xFCF3},
|
||||
{{0xFE7D, 0xFE7A}, 0xFCF4},
|
||||
{{0xFE7D, 0xFE7B}, 0xFCF4},
|
||||
{{0xFE8D, 0x0653}, 0xFE81},
|
||||
{{0xFE8D, 0x0654}, 0xFE83},
|
||||
{{0xFE8D, 0x0655}, 0xFE87},
|
||||
{{0xFE8D, 0xFE70}, 0xFD3D},
|
||||
{{0xFE8E, 0x0653}, 0xFE82},
|
||||
{{0xFE8E, 0x0654}, 0xFE84},
|
||||
{{0xFE8E, 0x0655}, 0xFE88},
|
||||
{{0xFE8E, 0xFE70}, 0xFD3C},
|
||||
{{0xFEE9, 0x0654}, 0xFBA4},
|
||||
{{0xFEEA, 0x0654}, 0xFBA5},
|
||||
{{0xFEED, 0x0654}, 0xFE85},
|
||||
{{0xFEEE, 0x0654}, 0xFE86},
|
||||
{{0xFEEF, 0x0654}, 0xFE89},
|
||||
{{0xFEEF, 0x0670}, 0xFC5D},
|
||||
{{0xFEF0, 0x0654}, 0xFE8A},
|
||||
{{0xFEF0, 0x0670}, 0xFC90},
|
||||
{{0xFEF1, 0x0654}, 0xFE89},
|
||||
{{0xFEF1, 0x0670}, 0xFC5D},
|
||||
{{0xFEF2, 0x0654}, 0xFE8A},
|
||||
{{0xFEF2, 0x0670}, 0xFC90},
|
||||
{{0xFEF3, 0x0654}, 0xFE8B},
|
||||
{{0xFEF4, 0x0654}, 0xFE8C},
|
||||
{{0xFEFB, 0x0653}, 0xFEF5},
|
||||
{{0xFEFB, 0x0654}, 0xFEF7},
|
||||
{{0xFEFB, 0x0655}, 0xFEF9},
|
||||
{{0xFEFC, 0x0653}, 0xFEF6},
|
||||
{{0xFEFC, 0x0654}, 0xFEF8},
|
||||
{{0xFEFC, 0x0655}, 0xFEFA},
|
||||
};
|
||||
|
||||
|
||||
static const Uchar32 NSMShap[][4] = {
|
||||
{0xFE70, 0xFE71, 0xFE70, 0xFE71,},
|
||||
{0xFE72, 0xFE72, 0xFE72, 0xFE72,},
|
||||
{0xFE74, 0xFE74, 0xFE74, 0xFE74,},
|
||||
{0xFE76, 0xFE77, 0xFE76, 0xFE77,},
|
||||
{0xFE78, 0xFE79, 0xFE78, 0xFE79,},
|
||||
{0xFE7A, 0xFE7B, 0xFE7A, 0xFE7B,},
|
||||
{0xFE7C, 0xFE7D, 0xFE7C, 0xFE7D,},
|
||||
{0xFE7E, 0xFE7F, 0xFE7E, 0xFE7F,},
|
||||
};
|
||||
|
||||
#ifndef UNIBIDI_ACCESS_SHAPE_TABLE
|
||||
# define UNIBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) \
|
||||
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
|
||||
#endif
|
||||
|
||||
#define UNIBIDI_GET_ARABIC_SHAPE_NSM(x,shape) \
|
||||
UNIBIDI_ACCESS_SHAPE_TABLE(NSMShap, 0x064B, 0x0652, (x), (shape))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1693
-387
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2019, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** mgbidi-bidi-types-list.inc:
|
||||
**
|
||||
** The list of BIDI types
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/08
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#ifndef _UNIBIDI_ADD_TYPE
|
||||
# define _UNIBIDI_ADD_TYPE(x,y)
|
||||
#endif
|
||||
#ifndef _UNIBIDI_ADD_ALIAS
|
||||
# define _UNIBIDI_ADD_ALIAS(x1,x2)
|
||||
#endif
|
||||
|
||||
#if !defined(_UNIBIDI_PAR_TYPES) || defined(_UNIBIDI_ALL_TYPES)
|
||||
|
||||
_UNIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right letter */
|
||||
_UNIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left letter */
|
||||
_UNIBIDI_ADD_TYPE (AL, 'A') /* Arabic Letter */
|
||||
_UNIBIDI_ADD_TYPE (EN, '1') /* European Numeral */
|
||||
_UNIBIDI_ADD_TYPE (AN, '9') /* Arabic Numeral */
|
||||
_UNIBIDI_ADD_TYPE (ES, 'w') /* European number Separator */
|
||||
_UNIBIDI_ADD_TYPE (ET, 'w') /* European number Terminator */
|
||||
_UNIBIDI_ADD_TYPE (CS, 'w') /* Common Separator */
|
||||
_UNIBIDI_ADD_TYPE (NSM, '`') /* Non Spacing Mark */
|
||||
_UNIBIDI_ADD_TYPE (BN, 'b') /* Boundary Neutral */
|
||||
_UNIBIDI_ADD_TYPE (BS, 'B') /* Block Separator */
|
||||
_UNIBIDI_ADD_TYPE (SS, 'S') /* Segment Separator */
|
||||
_UNIBIDI_ADD_TYPE (WS, '_') /* WhiteSpace */
|
||||
_UNIBIDI_ADD_TYPE (ON, 'n') /* Other Neutral */
|
||||
_UNIBIDI_ADD_TYPE (LRE, '+') /* Left-to-Right Embedding */
|
||||
_UNIBIDI_ADD_TYPE (RLE, '+') /* Right-to-Left Embedding */
|
||||
_UNIBIDI_ADD_TYPE (LRO, '+') /* Left-to-Right Override */
|
||||
_UNIBIDI_ADD_TYPE (RLO, '+') /* Right-to-Left Override */
|
||||
_UNIBIDI_ADD_TYPE (PDF, '-') /* Pop Directional Flag */
|
||||
_UNIBIDI_ADD_TYPE (LRI, '+') /* Left-to-Right Isolate */
|
||||
_UNIBIDI_ADD_TYPE (RLI, '+') /* Right-to-Left Isolate */
|
||||
_UNIBIDI_ADD_TYPE (FSI, '+') /* First-Strong Isolate */
|
||||
_UNIBIDI_ADD_TYPE (PDI, '-') /* Pop Directional Isolate */
|
||||
|
||||
#if defined(_UNIBIDI_ADD_ALIAS)
|
||||
_UNIBIDI_ADD_ALIAS (L, LTR)
|
||||
_UNIBIDI_ADD_ALIAS (R, RTL)
|
||||
_UNIBIDI_ADD_ALIAS (B, BS)
|
||||
_UNIBIDI_ADD_ALIAS (S, SS)
|
||||
#endif /* _UNIBIDI_ADD_ALIAS */
|
||||
|
||||
#if defined(_UNIBIDI_SENTINEL_TYPE) || defined(_UNIBIDI_ALL_TYPES)
|
||||
_UNIBIDI_ADD_TYPE (SENTINEL, '$') /* SENTINEL */
|
||||
#endif /* _UNIBIDI_SENTINEL_TYPES || _UNIBIDI_ALL_TYPES*/
|
||||
#endif /* !_UNIBIDI_PAR_TYPES || _UNIBIDI_ALL_TYPES */
|
||||
|
||||
#if defined(_UNIBIDI_PAR_TYPES) || defined(_UNIBIDI_ALL_TYPES)
|
||||
# if !defined(_UNIBIDI_ALL_TYPES)
|
||||
_UNIBIDI_ADD_TYPE (LTR, 'L') /* Left-To-Right paragraph */
|
||||
_UNIBIDI_ADD_TYPE (RTL, 'R') /* Right-To-Left paragraph */
|
||||
_UNIBIDI_ADD_TYPE (ON, 'n') /* directiOn-Neutral paragraph */
|
||||
# endif /* !_UNIBIDI_ALL_TYPES */
|
||||
_UNIBIDI_ADD_TYPE (WLTR, 'l') /* Weak Left To Right paragraph */
|
||||
_UNIBIDI_ADD_TYPE (WRTL, 'r') /* Weak Right To Left paragraph */
|
||||
#endif /* _UNIBIDI_PAR_TYPES || _UNIBIDI_ALL_TYPES*/
|
||||
|
||||
#if defined(_UNIBIDI_ENUM_TYPES)
|
||||
typedef enum {
|
||||
# define _UNIBIDI_ADD_TYPE _UNIBIDI_ENUM_ADD_TYPE
|
||||
# include "mgbidi-bidi-types-list.h"
|
||||
# undef _UNIBIDI_ADD_TYPE
|
||||
_UNIBIDI_TYPES_MAX
|
||||
} _UNIBIDI_ENUM_TYPES
|
||||
#endif /* _UNIBIDI_ENUM_TYPES */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2019, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-bidi.h:
|
||||
**
|
||||
** A general implementation of UNICODE BIDIRECTIONAL ALGORITHM for MiniGUI
|
||||
**
|
||||
** https://www.unicode.org/reports/tr9/
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/08
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#ifndef _MGFONT_UNICODE_BIDI_H
|
||||
#define _MGFONT_UNICODE_BIDI_H
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE_FULL
|
||||
#define UNIBIDI_UNICODE_CHARS 0x110000
|
||||
#else
|
||||
#define UNIBIDI_UNICODE_CHARS 0xFFFE
|
||||
#endif
|
||||
|
||||
/* Some special Unicode characters */
|
||||
|
||||
/* Bidirectional marks */
|
||||
#define BIDI_CHAR_LRM 0x200E
|
||||
#define BIDI_CHAR_RLM 0x200F
|
||||
#define BIDI_CHAR_LRE 0x202A
|
||||
#define BIDI_CHAR_RLE 0x202B
|
||||
#define BIDI_CHAR_PDF 0x202C
|
||||
#define BIDI_CHAR_LRO 0x202D
|
||||
#define BIDI_CHAR_RLO 0x202E
|
||||
#define BIDI_CHAR_LRI 0x2066
|
||||
#define BIDI_CHAR_RLI 0x2067
|
||||
#define BIDI_CHAR_FSI 0x2068
|
||||
#define BIDI_CHAR_PDI 0x2069
|
||||
|
||||
/* Line and Paragraph Separators */
|
||||
#define BIDI_CHAR_LS 0x2028
|
||||
#define BIDI_CHAR_PS 0x2029
|
||||
|
||||
/* Arabic Joining marks */
|
||||
#define BIDI_CHAR_ZWNJ 0x200C
|
||||
#define BIDI_CHAR_ZWJ 0x200D
|
||||
|
||||
/* Hebrew and Arabic */
|
||||
#define BIDI_CHAR_HEBREW_ALEF 0x05D0
|
||||
#define BIDI_CHAR_ARABIC_ALEF 0x0627
|
||||
#define BIDI_CHAR_ARABIC_ZERO 0x0660
|
||||
#define BIDI_CHAR_PERSIAN_ZERO 0x06F0
|
||||
|
||||
/* Misc */
|
||||
#define BIDI_CHAR_ZWNBSP 0xFEFF
|
||||
|
||||
/* Char we place for a deleted slot, to delete later */
|
||||
#define BIDI_CHAR_FILL BIDI_CHAR_ZWNBSP
|
||||
|
||||
/* some general macros */
|
||||
#define STRINGIZE(symbol) #symbol
|
||||
|
||||
/* A few macros for working with bits */
|
||||
#define BIDI_TEST_BITS(x, mask) (((x) & (mask)) ? 1 : 0)
|
||||
|
||||
#define BIDI_INCLUDE_BITS(x, mask) ((x) | (mask))
|
||||
|
||||
#define BIDI_EXCLUDE_BITS(x, mask) ((x) & ~(mask))
|
||||
|
||||
#define BIDI_SET_BITS(x, mask) ((x) |= (mask))
|
||||
|
||||
#define BIDI_UNSET_BITS(x, mask) ((x) &= ~(mask))
|
||||
|
||||
#define BIDI_ADJUST_BITS(x, mask, cond) \
|
||||
((x) = ((x) & ~(mask)) | ((cond) ? (mask) : 0))
|
||||
|
||||
#define BIDI_ADJUST_AND_TEST_BITS(x, mask, cond) \
|
||||
BIDI_TEST_BITS(BIDI_ADJUST_BITS((x), (mask), (cond)), (mask))
|
||||
|
||||
/* The maximum embedding level value assigned by explicit marks */
|
||||
#define BIDI_MAX_EXPLICIT_LEVEL 125
|
||||
|
||||
/* The maximum *number* of different resolved embedding levels: 0-126 */
|
||||
#define BIDI_MAX_RESOLVED_LEVELS 127
|
||||
|
||||
/* The maximum *number* of nested brackets: 0-63 */
|
||||
#define BIDI_MAX_NESTED_BRACKET_PAIRS 63
|
||||
|
||||
#define BIDI_SENTINEL -1
|
||||
|
||||
enum _BidiJoiningTypeEnum {
|
||||
# define _UNIBIDI_ADD_TYPE(TYPE,SYMBOL) \
|
||||
BIDI_JOINING_TYPE_##TYPE = BIDI_JOINING_TYPE_##TYPE##_VAL,
|
||||
# include "unicode-joining-types-list.inc"
|
||||
# undef _UNIBIDI_ADD_TYPE
|
||||
_UNIBIDI_JOINING_TYPE_JUNK /* Don't use this */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct _BidiRun BidiRun;
|
||||
|
||||
struct _BidiRun {
|
||||
BidiRun *prev;
|
||||
BidiRun *next;
|
||||
|
||||
/* Additional links for connecting the isolate tree */
|
||||
BidiRun *prev_isolate;
|
||||
BidiRun *next_isolate;
|
||||
|
||||
int pos, len;
|
||||
BidiBracketType bracket_type;
|
||||
BidiType type;
|
||||
BidiLevel level;
|
||||
BidiLevel isolate_level;
|
||||
};
|
||||
|
||||
#define swap(a,b) \
|
||||
do { \
|
||||
void *t; \
|
||||
(t) = (a); \
|
||||
(a) = (b); \
|
||||
(b) = (t); \
|
||||
} while(0)
|
||||
|
||||
#define merge_lists(a,b) \
|
||||
do { \
|
||||
swap((a)->prev->next, (b)->prev->next); \
|
||||
swap((a)->prev, (b)->prev); \
|
||||
} while(0)
|
||||
|
||||
#define delete_node(x) \
|
||||
do { \
|
||||
(x)->prev->next = (x)->next; \
|
||||
(x)->next->prev = (x)->prev; \
|
||||
} while(0)
|
||||
|
||||
#define insert_node_before(x, list) \
|
||||
do { \
|
||||
(x)->prev = (list)->prev; \
|
||||
(list)->prev->next = (x); \
|
||||
(x)->next = (list); \
|
||||
(list)->prev = (x); \
|
||||
} while(0)
|
||||
|
||||
#define move_node_before(x, list) \
|
||||
do { \
|
||||
if ((x)->prev) { \
|
||||
delete_node(x); \
|
||||
} \
|
||||
insert_node_before((x), (list)); \
|
||||
} while(0)
|
||||
|
||||
#define for_run_list(x, list) \
|
||||
for ((x) = (list)->next; (x)->type != BIDI_TYPE_SENTINEL; (x) = (x)->next)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* !_MGFONT_UNICODE_BIDI_H */
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-break-arabic.c:
|
||||
** The implementation to tailor Arabic breaks
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/27
|
||||
**
|
||||
** This implementation is derived from LGPL'd Pango.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "unicode-ops.h"
|
||||
|
||||
#define ALEF_WITH_MADDA_ABOVE 0x0622
|
||||
#define YEH_WITH_HAMZA_ABOVE 0x0626
|
||||
#define ALEF 0x0627
|
||||
#define WAW 0x0648
|
||||
#define YEH 0x064A
|
||||
|
||||
#define MADDAH_ABOVE 0x0653
|
||||
#define HAMZA_ABOVE 0x0654
|
||||
#define HAMZA_BELOW 0x0655
|
||||
|
||||
/*
|
||||
* Arabic characters with canonical decompositions that are not just
|
||||
* ligatures. The characters U+06C0, U+06C2, and U+06D3 are intentionally
|
||||
* excluded as they are marked as "not an independent letter" in Unicode
|
||||
* Character Database's NamesList.txt
|
||||
*/
|
||||
#define IS_COMPOSITE(c) (ALEF_WITH_MADDA_ABOVE <= (c) && (c) <= YEH_WITH_HAMZA_ABOVE)
|
||||
|
||||
/* If a character is the second part of a composite Arabic character with an Alef */
|
||||
#define IS_COMPOSITE_WITH_ALEF(c) (MADDAH_ABOVE <= (c) && (c) <= HAMZA_BELOW)
|
||||
|
||||
void __mg_unicode_break_arabic(const Uchar32* ucs, int nr_ucs,
|
||||
BreakOppo* break_oppos)
|
||||
{
|
||||
int i;
|
||||
Uchar32 prev_wc, this_wc;
|
||||
|
||||
for (i = 0, prev_wc = 0; i < nr_ucs; i++, prev_wc = this_wc) {
|
||||
this_wc = ucs[i];
|
||||
|
||||
/*
|
||||
* Unset backspace_deletes_character for various combinations.
|
||||
*
|
||||
* A few more combinations may need to be handled here, but are not
|
||||
* handled yet, as expectations of users is not known or may differ
|
||||
* among different languages or users:
|
||||
* some letters combined with U+0658 ARABIC MARK NOON GHUNNA;
|
||||
* combinations considered one letter in Azerbaijani (WAW+SUKUN and
|
||||
* FARSI_YEH+HAMZA_ABOVE); combinations of YEH and ALEF_MAKSURA with
|
||||
* HAMZA_BELOW (Qur'anic); TATWEEL+HAMZA_ABOVE (Qur'anic).
|
||||
*
|
||||
* FIXME: Ordering these in some other way may lower the time spent here, or not.
|
||||
*/
|
||||
if (IS_COMPOSITE (this_wc) ||
|
||||
(prev_wc == ALEF && IS_COMPOSITE_WITH_ALEF (this_wc)) ||
|
||||
(this_wc == HAMZA_ABOVE && (prev_wc == WAW || prev_wc == YEH)))
|
||||
break_oppos[i + 1] &= ~BOV_GB_BACKSPACE_DEL_CH;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-break-thai.c:
|
||||
** The implementation to tailor Thai breaks
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/27
|
||||
**
|
||||
** This implementation is derived from LGPL'd Pango.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "unicode-ops.h"
|
||||
|
||||
void __mg_unicode_break_thai(const Uchar32* ucs, int nr_ucs,
|
||||
BreakOppo* break_oppos)
|
||||
{
|
||||
_WRN_PRINTF("NOT IMPLEMENTED");
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+168
-4
@@ -34,9 +34,12 @@
|
||||
|
||||
/*
|
||||
** Some operators to check Emoji.
|
||||
** Implementation of the functions is based on some code from LGPL'd Pango.
|
||||
** Implementation of the functions is based on some code from HarfBuzz
|
||||
** (licensed under MIT):
|
||||
**
|
||||
** Created by WEI Yongming at 2019/02/26
|
||||
** https://github.com/harfbuzz/harfbuzz
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/01
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -50,7 +53,7 @@
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "unicode-ops.h"
|
||||
#include "unicode-emoji-table.h"
|
||||
#include "unicode-emoji-tables.h"
|
||||
|
||||
static int interval_compare(const void *key, const void *elt)
|
||||
{
|
||||
@@ -82,7 +85,7 @@ DEFINE_unicode_is_(emoji)
|
||||
DEFINE_unicode_is_(emoji_presentation)
|
||||
DEFINE_unicode_is_(emoji_modifier)
|
||||
DEFINE_unicode_is_(emoji_modifier_base)
|
||||
DEFINE_unicode_is_(emoji_extended_pictographic)
|
||||
DEFINE_unicode_is_(extended_pictographic)
|
||||
|
||||
BOOL _unicode_is_emoji_text_default(Uchar32 ch)
|
||||
{
|
||||
@@ -104,4 +107,165 @@ BOOL _unicode_is_regional_indicator(Uchar32 ch)
|
||||
return (ch >= 0x1F1E6 && ch <= 0x1F1FF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of EmojiIterator is based on Chromium's Ragel-based
|
||||
* parser:
|
||||
*
|
||||
* https://chromium-review.googlesource.com/c/chromium/src/+/1264577
|
||||
*
|
||||
* The grammar file emoji_presentation_scanner.rl was just modified to
|
||||
* adapt the function signature and variables to our usecase. The
|
||||
* grammar itself was NOT modified:
|
||||
*
|
||||
* https://chromium-review.googlesource.com/c/chromium/src/+/1264577/3/third_party/blink/renderer/platform/fonts/emoji_presentation_scanner.rl
|
||||
*
|
||||
* The emoji_presentation_scanner.c is generated from .rl file by
|
||||
* running ragel on it.
|
||||
*
|
||||
* The categorization is also based on:
|
||||
*
|
||||
* https://chromium-review.googlesource.com/c/chromium/src/+/1264577/3/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator.h
|
||||
*
|
||||
* The iterator next() is based on:
|
||||
*
|
||||
* https://chromium-review.googlesource.com/c/chromium/src/+/1264577/3/third_party/blink/renderer/platform/fonts/symbols_iterator.cc
|
||||
*
|
||||
* // Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
* // Use of this source code is governed by a BSD-style license that can be
|
||||
* // found in the LICENSE file.
|
||||
*/
|
||||
|
||||
const Uchar32 kCombiningEnclosingCircleBackslashCharacter = 0x20E0;
|
||||
const Uchar32 kCombiningEnclosingKeycapCharacter = 0x20E3;
|
||||
const Uchar32 kVariationSelector15Character = 0xFE0E;
|
||||
const Uchar32 kVariationSelector16Character = 0xFE0F;
|
||||
const Uchar32 kZeroWidthJoinerCharacter = 0x200D;
|
||||
|
||||
enum EmojiScannerCategory {
|
||||
EMOJI = 0,
|
||||
EMOJI_TEXT_PRESENTATION = 1,
|
||||
EMOJI_EMOJI_PRESENTATION = 2,
|
||||
EMOJI_MODIFIER_BASE = 3,
|
||||
EMOJI_MODIFIER = 4,
|
||||
EMOJI_VS_BASE = 5,
|
||||
REGIONAL_INDICATOR = 6,
|
||||
KEYCAP_BASE = 7,
|
||||
COMBINING_ENCLOSING_KEYCAP = 8,
|
||||
COMBINING_ENCLOSING_CIRCLE_BACKSLASH = 9,
|
||||
ZWJ = 10,
|
||||
VS15 = 11,
|
||||
VS16 = 12,
|
||||
TAG_BASE = 13,
|
||||
TAG_SEQUENCE = 14,
|
||||
TAG_TERM = 15,
|
||||
kMaxEmojiScannerCategory = 16
|
||||
};
|
||||
|
||||
static unsigned char emojiSegmentationCategory (Uchar32 codepoint)
|
||||
{
|
||||
/* Specific ones first. */
|
||||
if (codepoint == kCombiningEnclosingKeycapCharacter)
|
||||
return COMBINING_ENCLOSING_KEYCAP;
|
||||
if (codepoint == kCombiningEnclosingCircleBackslashCharacter)
|
||||
return COMBINING_ENCLOSING_CIRCLE_BACKSLASH;
|
||||
if (codepoint == kZeroWidthJoinerCharacter)
|
||||
return ZWJ;
|
||||
if (codepoint == kVariationSelector15Character)
|
||||
return VS15;
|
||||
if (codepoint == kVariationSelector16Character)
|
||||
return VS16;
|
||||
if (codepoint == 0x1F3F4)
|
||||
return TAG_BASE;
|
||||
if ((codepoint >= 0xE0030 && codepoint <= 0xE0039) ||
|
||||
(codepoint >= 0xE0061 && codepoint <= 0xE007A))
|
||||
return TAG_SEQUENCE;
|
||||
if (codepoint == 0xE007F)
|
||||
return TAG_TERM;
|
||||
|
||||
if (_unicode_is_emoji_modifier_base (codepoint))
|
||||
return EMOJI_MODIFIER_BASE;
|
||||
if (_unicode_is_emoji_modifier (codepoint))
|
||||
return EMOJI_MODIFIER;
|
||||
if (_unicode_is_regional_indicator (codepoint))
|
||||
return REGIONAL_INDICATOR;
|
||||
if (_unicode_is_emoji_keycap_base (codepoint))
|
||||
return KEYCAP_BASE;
|
||||
|
||||
if (_unicode_is_emoji_emoji_default (codepoint))
|
||||
return EMOJI_EMOJI_PRESENTATION;
|
||||
if (_unicode_is_emoji_text_default (codepoint))
|
||||
return EMOJI_TEXT_PRESENTATION;
|
||||
if (_unicode_is_emoji (codepoint))
|
||||
return EMOJI;
|
||||
|
||||
/* Ragel state machine will interpret unknown category as "any". */
|
||||
return kMaxEmojiScannerCategory;
|
||||
}
|
||||
|
||||
|
||||
typedef BOOL bool;
|
||||
enum { false = FALSE, true = TRUE };
|
||||
typedef unsigned char *emoji_text_iter_t;
|
||||
|
||||
#include "emoji_presentation_scanner.inc"
|
||||
|
||||
EmojiIterator * __mg_emoji_iterator_init (EmojiIterator *iter,
|
||||
const Uchar32* ucs, int nr_ucs, Uint8* types_buff)
|
||||
{
|
||||
int i;
|
||||
Uint8 *types = types_buff;
|
||||
const Uchar32 *p;
|
||||
|
||||
assert (nr_ucs > 0);
|
||||
|
||||
p = ucs;
|
||||
for (i = 0; i < nr_ucs; i++) {
|
||||
types[i] = emojiSegmentationCategory (*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
iter->text_start = iter->start = iter->end = ucs;
|
||||
iter->text_end = ucs + nr_ucs;
|
||||
iter->is_emoji = FALSE;
|
||||
|
||||
iter->types = types;
|
||||
iter->n_chars = nr_ucs;
|
||||
iter->cursor = 0;
|
||||
|
||||
__mg_emoji_iterator_next (iter);
|
||||
return iter;
|
||||
}
|
||||
|
||||
BOOL __mg_emoji_iterator_next (EmojiIterator *iter)
|
||||
{
|
||||
unsigned int old_cursor, cursor;
|
||||
BOOL is_emoji;
|
||||
|
||||
if (iter->end >= iter->text_end)
|
||||
return FALSE;
|
||||
|
||||
iter->start = iter->end;
|
||||
|
||||
old_cursor = cursor = iter->cursor;
|
||||
cursor = scan_emoji_presentation (iter->types + cursor,
|
||||
iter->types + iter->n_chars,
|
||||
&is_emoji) - iter->types;
|
||||
|
||||
do {
|
||||
iter->cursor = cursor;
|
||||
iter->is_emoji = is_emoji;
|
||||
|
||||
if (cursor == iter->n_chars)
|
||||
break;
|
||||
|
||||
cursor = scan_emoji_presentation (iter->types + cursor,
|
||||
iter->types + iter->n_chars,
|
||||
&is_emoji) - iter->types;
|
||||
}
|
||||
while (iter->is_emoji == is_emoji);
|
||||
|
||||
iter->end = iter->start + (iter->cursor - old_cursor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2019, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** mgbidi-joining-types-list.h:
|
||||
**
|
||||
** The list of joining types
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/08
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#ifndef _UNIBIDI_ADD_TYPE
|
||||
# define _UNIBIDI_ADD_TYPE(x,y)
|
||||
#endif
|
||||
|
||||
_UNIBIDI_ADD_TYPE (U, '|') /* nUn-joining, e.g. Full Stop */
|
||||
_UNIBIDI_ADD_TYPE (R, '<') /* Right-joining, e.g. Arabic Letter Dal */
|
||||
_UNIBIDI_ADD_TYPE (D, '+') /* Dual-joining, e.g. Arabic Letter Ain */
|
||||
_UNIBIDI_ADD_TYPE (C, '-') /* join-Causing, e.g. Tatweel, ZWJ */
|
||||
_UNIBIDI_ADD_TYPE (T, '^') /* Transparent, e.g. Arabic Fatha */
|
||||
_UNIBIDI_ADD_TYPE (L, '>') /* Left-joining, i.e. fictional */
|
||||
_UNIBIDI_ADD_TYPE (G, '~') /* iGnored, e.g. LRE, RLE, ZWNBSP */
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-joining-types.c: character joining types
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/11
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include "unicode-bidi.h"
|
||||
|
||||
enum _BidiJoiningTypeShortEnum {
|
||||
#define _UNIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = BIDI_JOINING_TYPE_##TYPE,
|
||||
#include "unicode-joining-types-list.inc"
|
||||
#undef _UNIBIDI_ADD_TYPE
|
||||
_UNIBIDI_NUM_TYPES
|
||||
};
|
||||
|
||||
#include "unicode-joining-type-table.inc"
|
||||
|
||||
BidiJoiningType GUIAPI UCharGetJoiningType(Uchar32 ch)
|
||||
{
|
||||
return UNIBIDI_GET_JOINING_TYPE (ch);
|
||||
}
|
||||
|
||||
void GUIAPI UStrGetJoiningTypes (const Uchar32 *ucs, int len,
|
||||
BidiJoiningType *joining_types)
|
||||
{
|
||||
register int i = len;
|
||||
for (; i; i--) {
|
||||
*joining_types++ = UNIBIDI_GET_JOINING_TYPE (*ucs);
|
||||
ucs++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-joining.c:
|
||||
** The implementation of Arabic joining algorithm
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/11
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include "unicode-bidi.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
/*======================================================================
|
||||
* For debugging, define some functions for printing joining types and
|
||||
* properties.
|
||||
*----------------------------------------------------------------------*/
|
||||
|
||||
static char get_char_from_joining_type(BidiJoiningType j, BOOL visual)
|
||||
{
|
||||
/* switch left and right if on visual run */
|
||||
if (visual & ((BIDI_JOINS_RIGHT (j) && !BIDI_JOINS_LEFT (j)) |
|
||||
(!BIDI_JOINS_RIGHT (j) && BIDI_JOINS_LEFT (j))))
|
||||
j ^= BIDI_MASK_JOINS_RIGHT | BIDI_MASK_JOINS_LEFT;
|
||||
|
||||
#define _UNIBIDI_ADD_TYPE(TYPE,SYMBOL) \
|
||||
if (BIDI_IS_JOINING_TYPE_##TYPE(j)) return SYMBOL;
|
||||
#include "unicode-joining-types-list.inc"
|
||||
#undef _UNIBIDI_ADD_TYPE
|
||||
|
||||
return '?';
|
||||
}
|
||||
|
||||
static void print_joining_types(const BidiLevel *embedding_levels,
|
||||
int len, const BidiJoiningType *jtypes)
|
||||
{
|
||||
register int i;
|
||||
|
||||
_DBG_PRINTF (" Join. types: ");
|
||||
for (i = 0; i < len; i++)
|
||||
_DBG_PRINTF ("%c", get_char_from_joining_type (jtypes[i],
|
||||
!BIDI_LEVEL_IS_RTL(embedding_levels[i])));
|
||||
_DBG_PRINTF ("\n");
|
||||
}
|
||||
|
||||
#endif /* _DEBUG */
|
||||
|
||||
#define UNIBIDI_CONSISTENT_LEVEL(i) \
|
||||
(BIDI_IS_EXPLICIT_OR_BN (bidi_types[(i)]) \
|
||||
? BIDI_SENTINEL \
|
||||
: embedding_levels[(i)])
|
||||
|
||||
#define BIDI_LEVELS_MATCH(i, j) \
|
||||
((i) == (j) || (i) == BIDI_SENTINEL || (j) == BIDI_SENTINEL)
|
||||
|
||||
void GUIAPI UBidiJoinArabic(const BidiType *bidi_types,
|
||||
const BidiLevel *embedding_levels, int len,
|
||||
BidiArabicProp *ar_props)
|
||||
{
|
||||
if (len == 0) return;
|
||||
|
||||
#ifdef _DEBUG
|
||||
print_joining_types (embedding_levels, len, ar_props);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
/* The joining algorithm turned out very very dirty :(. That's what happens
|
||||
* when you follow the standard which has never been implemented closely
|
||||
* before.
|
||||
*/
|
||||
|
||||
/* 8.2 Arabic - Cursive Joining */
|
||||
_DBG_PRINTF ("Arabic cursive joining");
|
||||
{
|
||||
/* The following do not need to be initialized as long as joins is
|
||||
* initialized to FALSE. We just do to turn off compiler warnings. */
|
||||
register int saved = 0;
|
||||
register BidiLevel saved_level = BIDI_SENTINEL;
|
||||
register BOOL saved_shapes = FALSE;
|
||||
register BidiArabicProp saved_joins_following_mask = 0;
|
||||
|
||||
register BOOL joins = FALSE;
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (!BIDI_IS_JOINING_TYPE_G (ar_props[i]))
|
||||
{
|
||||
register BOOL disjoin = FALSE;
|
||||
register BOOL shapes = BIDI_ARAB_SHAPES (ar_props[i]);
|
||||
register BidiLevel level = UNIBIDI_CONSISTENT_LEVEL (i);
|
||||
|
||||
if (joins && !BIDI_LEVELS_MATCH (saved_level, level))
|
||||
{
|
||||
disjoin = TRUE;
|
||||
joins = FALSE;
|
||||
}
|
||||
|
||||
if (!BIDI_IS_JOIN_SKIPPED (ar_props[i]))
|
||||
{
|
||||
register const BidiArabicProp joins_preceding_mask =
|
||||
BIDI_JOINS_PRECEDING_MASK (level);
|
||||
|
||||
if (!joins)
|
||||
{
|
||||
if (shapes)
|
||||
BIDI_UNSET_BITS (ar_props[i], joins_preceding_mask);
|
||||
}
|
||||
else if (!BIDI_TEST_BITS (ar_props[i], joins_preceding_mask))
|
||||
{
|
||||
disjoin = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
register int j;
|
||||
/* This is a FriBidi extension: we set joining properties
|
||||
* for skipped characters in between, so we can put NSMs on tatweel
|
||||
* later if we want. Useful on console for example.
|
||||
*/
|
||||
for (j = saved + 1; j < i; j++)
|
||||
BIDI_SET_BITS (ar_props[j], joins_preceding_mask | saved_joins_following_mask);
|
||||
}
|
||||
}
|
||||
|
||||
if (disjoin && saved_shapes)
|
||||
BIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);
|
||||
|
||||
if (!BIDI_IS_JOIN_SKIPPED (ar_props[i]))
|
||||
{
|
||||
saved = i;
|
||||
saved_level = level;
|
||||
saved_shapes = shapes;
|
||||
saved_joins_following_mask =
|
||||
BIDI_JOINS_FOLLOWING_MASK (level);
|
||||
joins =
|
||||
BIDI_TEST_BITS (ar_props[i], saved_joins_following_mask);
|
||||
}
|
||||
}
|
||||
if ((joins) && saved_shapes)
|
||||
BIDI_UNSET_BITS (ar_props[saved], saved_joins_following_mask);
|
||||
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
print_joining_types (embedding_levels, len, ar_props);
|
||||
#endif /* _DEBUG */
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+580
-169
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-shape-arabic.c:
|
||||
** The implementation of Arabic joining algorithm
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/11
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include "unicode-bidi.h"
|
||||
|
||||
typedef struct _PairMap {
|
||||
Uchar32 pair[2], to;
|
||||
} PairMap;
|
||||
|
||||
#define UNIBIDI_ACCESS_SHAPE_TABLE(table,min,max,x,shape) (table), (min), (max)
|
||||
# define UNIBIDI_ACCESS_SHAPE_TABLE_REAL(table,min,max,x,shape) \
|
||||
(((x)<(min)||(x)>(max))?(x):(table)[(x)-(min)][(shape)])
|
||||
|
||||
#include "unicode-arabic-shaping-table.inc"
|
||||
#include "unicode-arabic-misc-table.inc"
|
||||
|
||||
static void unibidi_shape_arabic_joining (const Uchar32 table[][4],
|
||||
Uchar32 min, Uchar32 max, const int len,
|
||||
const BidiArabicProp *ar_props,
|
||||
Uchar32 *str)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
if (BIDI_ARAB_SHAPES(ar_props[i]))
|
||||
str[i] = UNIBIDI_ACCESS_SHAPE_TABLE_REAL(table, min, max, str[i],
|
||||
BIDI_JOIN_SHAPE (ar_props[i]));
|
||||
}
|
||||
}
|
||||
|
||||
static int comp_PairMap (const void *pa, const void *pb)
|
||||
{
|
||||
PairMap *a = (PairMap *)pa;
|
||||
PairMap *b = (PairMap *)pb;
|
||||
|
||||
if (a->pair[0] != b->pair[0])
|
||||
return a->pair[0] < b->pair[0] ? -1 : +1;
|
||||
else
|
||||
return a->pair[1] < b->pair[1] ? -1 :
|
||||
a->pair[1] > b->pair[1] ? +1 : 0;
|
||||
}
|
||||
|
||||
|
||||
static Uchar32 find_pair_match (const PairMap *table, int size,
|
||||
Uchar32 first, Uchar32 second)
|
||||
{
|
||||
PairMap *match;
|
||||
PairMap x;
|
||||
x.pair[0] = first;
|
||||
x.pair[1] = second;
|
||||
x.to = 0;
|
||||
match = bsearch (&x, table, size, sizeof (table[0]), comp_PairMap);
|
||||
return match ? match->to : 0;
|
||||
}
|
||||
|
||||
#define PAIR_MATCH(table,len,first,second) \
|
||||
((first)<(table[0].pair[0])||(first)>(table[len-1].pair[0])?0: \
|
||||
find_pair_match(table, len, first, second))
|
||||
|
||||
static void unibidi_shape_arabic_ligature(const PairMap *table,
|
||||
int size, const BidiLevel *embedding_levels, int len,
|
||||
BidiArabicProp *ar_props, Uchar32 *str)
|
||||
{
|
||||
/* TODO: This doesn't form ligatures for even-level Arabic text.
|
||||
* no big problem though. */
|
||||
register int i;
|
||||
|
||||
for (i = 0; i < len - 1; i++) {
|
||||
register Uchar32 c;
|
||||
if (BIDI_LEVEL_IS_RTL(embedding_levels[i]) &&
|
||||
embedding_levels[i] == embedding_levels[i+1] &&
|
||||
(c = PAIR_MATCH(table, size, str[i], str[i+1])))
|
||||
{
|
||||
str[i] = BIDI_CHAR_FILL;
|
||||
BIDI_SET_BITS(ar_props[i], BIDI_MASK_LIGATURED);
|
||||
str[i+1] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define DO_LIGATURING(table, levels, len, ar_props, str) \
|
||||
unibidi_shape_arabic_ligature ((table), \
|
||||
sizeof(table)/sizeof((table)[0]), levels, len, ar_props, str)
|
||||
|
||||
#define DO_SHAPING(tablemacro, len, ar_props, str) \
|
||||
unibidi_shape_arabic_joining (tablemacro(,), len, ar_props, str)
|
||||
|
||||
void UBidiShapeArabic(Uint32 flags, const BidiLevel *embedding_levels, int len,
|
||||
BidiArabicProp *ar_props, Uchar32 *str)
|
||||
{
|
||||
if (len == 0 || !str) return;
|
||||
|
||||
if (BIDI_TEST_BITS (flags, BIDI_FLAG_SHAPE_ARAB_PRES)) {
|
||||
DO_SHAPING (UNIBIDI_GET_ARABIC_SHAPE_PRES, len, ar_props, str);
|
||||
}
|
||||
|
||||
if (BIDI_TEST_BITS (flags, BIDI_FLAG_SHAPE_ARAB_LIGA)) {
|
||||
DO_LIGATURING (mandatory_liga_table, embedding_levels, len,
|
||||
ar_props, str);
|
||||
}
|
||||
|
||||
if (BIDI_TEST_BITS (flags, BIDI_FLAG_SHAPE_ARAB_CONSOLE)) {
|
||||
DO_LIGATURING (console_liga_table, embedding_levels, len,
|
||||
ar_props, str);
|
||||
DO_SHAPING (UNIBIDI_GET_ARABIC_SHAPE_NSM, len, ar_props, str);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-shape.c:
|
||||
** The implementation of Arabic joining algorithm
|
||||
**
|
||||
** Created by WEI Yongming at 2019/03/11
|
||||
**
|
||||
** This implementation is based on LGPL'd FriBidi:
|
||||
**
|
||||
** https://github.com/fribidi/fribidi
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#include "unicode-bidi.h"
|
||||
|
||||
void GUIAPI UBidiShapeMirroring(const BidiLevel *embedding_levels, int len,
|
||||
Uchar32* str)
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (len == 0 || !str) return;
|
||||
|
||||
/* L4. Mirror all characters that are in odd levels and have mirrors. */
|
||||
for (i = len - 1; i >= 0; i--) {
|
||||
if (BIDI_LEVEL_IS_RTL(embedding_levels[i])) {
|
||||
Uchar32 mirrored_ch;
|
||||
|
||||
if (UCharGetMirror(str[i], &mirrored_ch)) {
|
||||
str[i] = mirrored_ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GUIAPI UBidiShape(Uint32 flags,
|
||||
const BidiLevel *embedding_levels, int len,
|
||||
BidiArabicProp *ar_props, Uchar32 *str)
|
||||
{
|
||||
if (len == 0 || !str)
|
||||
return;
|
||||
|
||||
if (ar_props)
|
||||
UBidiShapeArabic(flags, embedding_levels, len, ar_props, str);
|
||||
|
||||
if (BIDI_TEST_BITS (flags, BIDI_FLAG_SHAPE_MIRRORING))
|
||||
UBidiShapeMirroring (embedding_levels, len, str);
|
||||
}
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
+18926
-13166
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2019, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
** unicode-vop.c: The implementation of UCharGetVerticalOrientation
|
||||
**
|
||||
** Reference:
|
||||
**
|
||||
** https://www.unicode.org/reports/tr50/
|
||||
**
|
||||
** Create by WEI Yongming at 2019/03/18
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
|
||||
#ifdef _MGCHARSET_UNICODE
|
||||
|
||||
#define U UCHAR_VOP_U
|
||||
#define R UCHAR_VOP_R
|
||||
#define Tu UCHAR_VOP_TU
|
||||
#define Tr UCHAR_VOP_TR
|
||||
|
||||
#include "unicode-vop-table.inc"
|
||||
|
||||
UVerticalOrient GUIAPI UCharGetVerticalOrientation(Uchar32 uc)
|
||||
{
|
||||
return UCHAR_GET_VOP(uc);
|
||||
}
|
||||
|
||||
#undef U
|
||||
#undef R
|
||||
#undef Tu
|
||||
#undef Tr
|
||||
|
||||
#endif /* _MGCHARSET_UNICODE */
|
||||
|
||||
+6
-5
@@ -67,24 +67,24 @@ static void* load_font_data (DEVFONT* devfont, const char* font_name, const char
|
||||
int tmp;
|
||||
|
||||
if ((tmp = fontGetWidthFromName (font_name)) == -1) {
|
||||
_MG_PRINTF ("FONT>UPF: Invalid font name (width): %s.\n", font_name);
|
||||
_WRN_PRINTF ("FONT>UPF: Invalid font name (width): %s.\n", font_name);
|
||||
goto error;
|
||||
}
|
||||
upf_info->width = (Uint8)tmp;
|
||||
|
||||
if ((tmp = fontGetHeightFromName (font_name)) == -1) {
|
||||
_MG_PRINTF ("FONT>UPF: Invalid font name (height): %s.\n", font_name);
|
||||
_WRN_PRINTF ("FONT>UPF: Invalid font name (height): %s.\n", font_name);
|
||||
goto error;
|
||||
}
|
||||
upf_info->height = (Uint8)tmp;
|
||||
|
||||
if ((fp = fopen (file_name, "rb")) == NULL) {
|
||||
_MG_PRINTF ("FONT>UPF: can't open font file: %s\n", file_name);
|
||||
_WRN_PRINTF ("FONT>UPF: can't open font file: %s\n", file_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((file_size = get_opened_file_size (fp)) <= 0) {
|
||||
_MG_PRINTF ("FONT>UPF: empty font file: %s\n", file_name);
|
||||
_WRN_PRINTF ("FONT>UPF: empty font file: %s\n", file_name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,8 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
||||
|
||||
advance = glyph->advance
|
||||
* GET_DEVFONT_SCALE (logfont, devfont);
|
||||
*px += advance;
|
||||
if (px)
|
||||
*px += advance;
|
||||
|
||||
return advance;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Copied from https://docs.microsoft.com/en-us/typography/script-development/use
|
||||
# On October 23, 2018; with documentd dated 02/07/2018.
|
||||
|
||||
0905 0946 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT E
|
||||
0905 093E ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AA
|
||||
0930 094D 0907 ; # DEVANAGARI LETTER RA, DEVANAGARI SIGN VIRAMA, DEVANAGARI LETTER I
|
||||
0909 0941 ; # DEVANAGARI LETTER U, DEVANAGARI VOWEL SIGN U
|
||||
090F 0945 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN CANDRA E
|
||||
090F 0946 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN SHORT E
|
||||
090F 0947 ; # DEVANAGARI LETTER E, DEVANAGARI VOWEL SIGN E
|
||||
0905 0949 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA O
|
||||
0906 0945 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN CANDRA E
|
||||
0905 094A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN SHORT O
|
||||
0906 0946 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN SHORT E
|
||||
0905 094B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN O
|
||||
0906 0947 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN E
|
||||
0905 094C ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AU
|
||||
0906 0948 ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN AI
|
||||
0905 0945 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN CANDRA E
|
||||
0905 093A ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OE
|
||||
0905 093B ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN OOE
|
||||
0906 093A ; # DEVANAGARI LETTER AA, DEVANAGARI VOWEL SIGN OE
|
||||
0905 094F ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN AW
|
||||
0905 0956 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UE
|
||||
0905 0957 ; # DEVANAGARI LETTER A, DEVANAGARI VOWEL SIGN UUE
|
||||
0985 09BE ; # BENGALI LETTER A, BENGALI VOWEL SIGN AA
|
||||
098B 09C3 ; # BENGALI LETTER VOCALIC R, BENGALI VOWEL SIGN VOCALIC R
|
||||
098C 09E2 ; # BENGALI LETTER VOCALIC L, BENGALI VOWEL SIGN VOCALIC L
|
||||
0A05 0A3E ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AA
|
||||
0A72 0A3F ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN I
|
||||
0A72 0A40 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN II
|
||||
0A73 0A41 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN U
|
||||
0A73 0A42 ; # GURMUKHI URA, GURMUKHI VOWEL SIGN UU
|
||||
0A72 0A47 ; # GURMUKHI IRI, GURMUKHI VOWEL SIGN EE
|
||||
0A05 0A48 ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AI
|
||||
0A73 0A4B ; # GURMUKHI URA, GURMUKHI VOWEL SIGN OO
|
||||
0A05 0A4C ; # GURMUKHI LETTER A, GURMUKHI VOWEL SIGN AU
|
||||
0A85 0ABE ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA
|
||||
0A85 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA E
|
||||
0A85 0AC7 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN E
|
||||
0A85 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AI
|
||||
0A85 0AC9 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN CANDRA O
|
||||
0A85 0ACB ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN O
|
||||
0A85 0ABE 0AC5 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN CANDRA E
|
||||
0A85 0ACC ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AU
|
||||
0A85 0ABE 0AC8 ; # GUJARATI LETTER A, GUJARATI VOWEL SIGN AA, GUJARATI VOWEL SIGN AI
|
||||
0AC5 0ABE ; # GUJARATI VOWEL SIGN CANDRA E, GUJARATI VOWEL SIGN AA
|
||||
0B05 0B3E ; # ORIYA LETTER A, ORIYA VOWEL SIGN AA
|
||||
0B0F 0B57 ; # ORIYA LETTER E, ORIYA AU LENGTH MARK
|
||||
0B13 0B57 ; # ORIYA LETTER O, ORIYA AU LENGTH MARK
|
||||
0C12 0C55 ; # TELUGU LETTER O, TELUGU LENGTH MARK
|
||||
0C12 0C4C ; # TELUGU LETTER O, TELUGU VOWEL SIGN AU
|
||||
0C3F 0C55 ; # TELUGU VOWEL SIGN I, TELUGU LENGTH MARK
|
||||
0C46 0C55 ; # TELUGU VOWEL SIGN E, TELUGU LENGTH MARK
|
||||
0C4A 0C55 ; # TELUGU VOWEL SIGN O, TELUGU LENGTH MARK
|
||||
0C89 0CBE ; # KANNADA LETTER U, KANNADA VOWEL SIGN AA
|
||||
0C92 0CCC ; # KANNADA LETTER O, KANNADA VOWEL SIGN AU
|
||||
0C8B 0CBE ; # KANNADA LETTER VOCALIC R, KANNADA VOWEL SIGN AA
|
||||
0D07 0D57 ; # MALAYALAM LETTER I, MALAYALAM AU LENGTH MARK
|
||||
0D09 0D57 ; # MALAYALAM LETTER U, MALAYALAM AU LENGTH MARK
|
||||
0D0E 0D46 ; # MALAYALAM LETTER E, MALAYALAM VOWEL SIGN E
|
||||
0D12 0D3E ; # MALAYALAM LETTER O, MALAYALAM VOWEL SIGN AA
|
||||
0D12 0D57 ; # MALAYALAM LETTER O, MALAYALAM AU LENGTH MARK
|
||||
0D85 0DCF ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN AELA-PILLA
|
||||
0D85 0DD0 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN KETTI AEDA-PILLA
|
||||
0D85 0DD1 ; # SINHALA LETTER AYANNA, SINHALA VOWEL SIGN DIGA AEDA-PILLA
|
||||
0D8B 0DDF ; # SINHALA LETTER UYANNA, SINHALA VOWEL SIGN GAYANUKITTA
|
||||
0D8D 0DD8 ; # SINHALA LETTER IRUYANNA, SINHALA VOWEL SIGN GAETTA-PILLA
|
||||
0D8F 0DDF ; # SINHALA LETTER ILUYANNA, SINHALA VOWEL SIGN GAYANUKITTA
|
||||
0D91 0DCA ; # SINHALA LETTER EYANNA, SINHALA SIGN AL-LAKUNA
|
||||
0D91 0DD9 ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA
|
||||
0D91 0DDA ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN DIGA KOMBUVA
|
||||
0D91 0DDC ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA
|
||||
0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA
|
||||
0D91 0DDD ; # SINHALA LETTER EYANNA, SINHALA VOWEL SIGN KOMBUVA HAA DIGA AELA-PILLA
|
||||
0D94 0DDF ; # SINHALA LETTER OYANNA, SINHALA VOWEL SIGN GAYANUKITTA
|
||||
11005 11038 ; # BRAHMI LETTER A, BRAHMI VOWEL SIGN AA
|
||||
1100B 1103E ; # BRAHMI LETTER VOCALIC R, BRAHMI VOWEL SIGN VOCALIC R
|
||||
1100F 11042 ; # BRAHMI LETTER E, BRAHMI VOWEL SIGN E
|
||||
11680 116AD ; # TAKRI LETTER A, TAKRI VOWEL SIGN AA
|
||||
11686 116B2 ; # TAKRI LETTER E, TAKRI VOWEL SIGN E
|
||||
11680 116B4 ; # TAKRI LETTER A, TAKRI VOWEL SIGN O
|
||||
11680 116B5 ; # TAKRI LETTER A, TAKRI VOWEL SIGN AU
|
||||
112B0 112E0 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AA
|
||||
112B0 112E5 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN E
|
||||
112B0 112E6 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AI
|
||||
112B0 112E7 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN O
|
||||
112B0 112E8 ; # KHUDAWADI LETTER A, KHUDAWADI VOWEL SIGN AU
|
||||
11481 114B0 ; # TIRHUTA LETTER A, TIRHUTA VOWEL SIGN AA
|
||||
114AA 114B5 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC R
|
||||
114AA 114B6 ; # TIRHUTA LETTER LA, TIRHUTA VOWEL SIGN VOCALIC RR
|
||||
1148B 114BA ; # TIRHUTA LETTER E, TIRHUTA VOWEL SIGN SHORT E
|
||||
1148D 114BA ; # TIRHUTA LETTER O, TIRHUTA VOWEL SIGN SHORT E
|
||||
11600 11639 ; # MODI LETTER A, MODI VOWEL SIGN E
|
||||
11600 1163A ; # MODI LETTER A, MODI VOWEL SIGN AI
|
||||
11601 11639 ; # MODI LETTER AA, MODI VOWEL SIGN E
|
||||
11601 1163A ; # MODI LETTER AA, MODI VOWEL SIGN AI
|
||||
+88
-19
@@ -1,28 +1,97 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g
|
||||
CFLAGS=-Wall -Werror -g -D__MINIGUI_LIB__ -I../../../include/
|
||||
COMPRESSION=2
|
||||
|
||||
all:bin2c qpf2c vbf2c upgradevbf bdf2vbf dumpupf qpf2upf upf2c
|
||||
all:mkmap-ucs-gb18030 mkmap-ucs-gb2312 \
|
||||
unicode-version.h \
|
||||
gen-unicode-version \
|
||||
gen-bidi-type-tab \
|
||||
gen-joining-type-tab \
|
||||
gen-arabic-shaping-tab \
|
||||
gen-mirroring-tab \
|
||||
gen-brackets-tab \
|
||||
gen-brackets-type-tab \
|
||||
gen-vop-tab
|
||||
|
||||
bin2c:bin2c.o
|
||||
mkmap-ucs-gb2312:mkmap-ucs-gb2312.o
|
||||
|
||||
qpf2c:qpf2c.o
|
||||
mkmap-ucs-gb18030:mkmap-ucs-gb18030.o
|
||||
|
||||
qpf2upf:qpf2upf.o
|
||||
gen-unicode-version:gen-unicode-version.o
|
||||
gen-bidi-type-tab:gen-bidi-type-tab.o packtab.o
|
||||
gen-joining-type-tab:gen-joining-type-tab.o packtab.o
|
||||
gen-arabic-shaping-tab:gen-arabic-shaping-tab.o packtab.o
|
||||
gen-mirroring-tab:gen-mirroring-tab.o packtab.o
|
||||
gen-brackets-tab:gen-brackets-tab.o packtab.o
|
||||
gen-brackets-type-tab:gen-brackets-type-tab.o packtab.o
|
||||
gen-vop-tab:gen-vop-tab.o packtab.o
|
||||
|
||||
upf2c:upf2c.c
|
||||
tables:unicode-version.h \
|
||||
unicode-bidi-type-table.inc \
|
||||
unicode-joining-type-table.inc \
|
||||
unicode-arabic-shaping-table.inc \
|
||||
unicode-bidi-mirroring-table.inc \
|
||||
unicode-bidi-brackets-table.inc \
|
||||
unicode-bidi-brackets-type-table.inc \
|
||||
unicode-vop-table.inc
|
||||
|
||||
vbf2c:vbf2c.o
|
||||
|
||||
makegbrbf:makegbrbf.o
|
||||
|
||||
makeucs2gbtable:makeucs2gbtable.o
|
||||
|
||||
upgradevbf:upgradevbf.o
|
||||
|
||||
bdf2vbf:bdf2vbf.c
|
||||
|
||||
dumpupf:
|
||||
gcc -lminigui_ths -lttf -ljpeg -lpng -lpthread -lm -lz -o dumpupf dumpupf.c
|
||||
unicode-version.h:ucd/ReadMe.txt gen-unicode-version
|
||||
./gen-unicode-version ucd/ReadMe.txt > unicode-version.h
|
||||
|
||||
clean:
|
||||
rm -f qpf2c qpf2upf upf2c vbf2c bin2c dumpqpf dumpupf dumpqpf2 upgradevbf bdf2vbf *.o
|
||||
rm -f *.o unicode-*.h unicode-*.inc \
|
||||
mkmap-ucs-gb2312 mkmap-gb18030-ucs.c mkmap-ucs-gb18030 \
|
||||
gen-unicode-version \
|
||||
gen-bidi-type-tab \
|
||||
gen-joining-type-tab \
|
||||
gen-arabic-shaping-tab \
|
||||
gen-mirroring-tab \
|
||||
gen-brackets-tab \
|
||||
gen-brackets-type-tab \
|
||||
gen-vop-tab
|
||||
|
||||
unicode-bidi-type-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
unicode-version.h \
|
||||
gen-bidi-type-tab
|
||||
./gen-bidi-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-joining-type-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
ucd/ArabicShaping.txt \
|
||||
unicode-version.h \
|
||||
gen-joining-type-tab
|
||||
./gen-joining-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-arabic-shaping-table.inc: \
|
||||
ucd/UnicodeData.txt \
|
||||
ucd/ArabicShaping.txt \
|
||||
unicode-version.h \
|
||||
gen-arabic-shaping-tab
|
||||
./gen-arabic-shaping-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-bidi-mirroring-table.inc: \
|
||||
ucd/BidiMirroring.txt \
|
||||
unicode-version.h \
|
||||
gen-mirroring-tab
|
||||
./gen-mirroring-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-bidi-brackets-table.inc: \
|
||||
ucd/BidiBrackets.txt \
|
||||
ucd/UnicodeData.txt \
|
||||
unicode-version.h \
|
||||
gen-brackets-tab
|
||||
./gen-brackets-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-bidi-brackets-type-table.inc: \
|
||||
ucd/BidiBrackets.txt \
|
||||
unicode-version.h \
|
||||
gen-brackets-type-tab
|
||||
./gen-brackets-type-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
unicode-vop-table.inc: \
|
||||
ucd/VerticalOrientation.txt \
|
||||
unicode-version.h \
|
||||
gen-vop-tab
|
||||
./gen-vop-tab $(COMPRESSION) $^ > $@
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
* Usage:
|
||||
* 1) Define your VBFINFO name as extern_vbfinfo in a C file.
|
||||
* 2) Please link this file with the C file defining your VBF file to compile an executable.
|
||||
* 3) Run the executable.
|
||||
*
|
||||
* Limitation:
|
||||
* Only VBF V1.0 is supported.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "vbf.h"
|
||||
|
||||
#define LEN_VERSION_INFO 10
|
||||
|
||||
#define VBF_VERSION "vbf-1.0**"
|
||||
|
||||
typedef int BOOL;
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define LEN_LOGFONT_NAME_FIELD 23
|
||||
#define LEN_DEVFONT_NAME 79
|
||||
|
||||
extern VBFINFO extern_vbfinfo;
|
||||
|
||||
#define vbf_to_dump extern_vbfinfo
|
||||
|
||||
BOOL dumpVBF (VBFINFO* vbf, char* file)
|
||||
{
|
||||
FILE* fp;
|
||||
char family [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
char style [LEN_LOGFONT_NAME_FIELD + 1];
|
||||
int len_offsets;
|
||||
int len_widths;
|
||||
int len_header;
|
||||
int len_bits = vbf->len_bits;
|
||||
int len_file;
|
||||
int num_chars = (vbf->last_char - vbf->first_char + 1);
|
||||
|
||||
len_header = 4 + 2 + 8 + 3 + 12 + 4 + LEN_VERSION_INFO;
|
||||
len_offsets = num_chars * sizeof (unsigned short);
|
||||
len_widths = num_chars * sizeof (unsigned char);
|
||||
|
||||
len_file = len_header + LEN_DEVFONT_NAME + 1 + len_offsets + len_widths + len_bits;
|
||||
sprintf (file, "%s.vbf", vbf->name);
|
||||
|
||||
if ((fp = fopen (file, "w+")) == NULL)
|
||||
return FALSE;
|
||||
|
||||
fwrite (VBF_VERSION, sizeof (char), LEN_VERSION_INFO, fp);
|
||||
fwrite (&len_header, sizeof (int), 1, fp);
|
||||
fwrite (&vbf->max_width, sizeof (char), 1, fp);
|
||||
fwrite (&vbf->ave_width, sizeof (char), 1, fp);
|
||||
fwrite (&vbf->height, sizeof (int), 1, fp);
|
||||
fwrite (&vbf->descent, sizeof (int), 1, fp);
|
||||
fwrite (&vbf->first_char, sizeof (unsigned char), 1, fp);
|
||||
fwrite (&vbf->last_char, sizeof (unsigned char), 1, fp);
|
||||
fwrite (&vbf->def_char, sizeof (unsigned char), 1, fp);
|
||||
|
||||
fwrite (&len_offsets, sizeof (int), 1, fp);
|
||||
fwrite (&len_widths, sizeof (int), 1, fp);
|
||||
fwrite (&len_bits, sizeof (int), 1, fp);
|
||||
fwrite (&len_file, sizeof (int), 1, fp);
|
||||
|
||||
fwrite (vbf->name, sizeof (char), LEN_DEVFONT_NAME + 1, fp);
|
||||
fwrite (vbf->offset, sizeof (unsigned short), num_chars, fp);
|
||||
fwrite (vbf->width, sizeof (unsigned char), num_chars, fp);
|
||||
|
||||
fwrite (vbf->bits, sizeof (unsigned char), len_bits, fp);
|
||||
|
||||
fclose (fp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
char file [256];
|
||||
|
||||
dumpVBF (&vbf_to_dump, file);
|
||||
printf ("The vbf font name: '%s'\n", vbf_to_dump.name);
|
||||
printf ("The VBF dump to file: '%s'\n", file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
url='http://www.unicode.org/Public/emoji/12.0/'
|
||||
files='emoji-data.txt emoji-sequences.txt emoji-variation-sequences.txt emoji-zwj-sequences.txt'
|
||||
|
||||
if test ! -d emoji; then
|
||||
mkdir emoji
|
||||
fi
|
||||
|
||||
cd emoji/
|
||||
|
||||
for file in $files
|
||||
do
|
||||
if [ -f $file ]; then
|
||||
echo "$file exists, skipping"
|
||||
else
|
||||
echo "Fetching $url$file"
|
||||
wget $url$file
|
||||
fi
|
||||
done
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
url='https://www.unicode.org/Public/UNIDATA/'
|
||||
files='ReadMe.txt Scripts.txt UnicodeData.txt LineBreak.txt SpecialCasing.txt CaseFolding.txt CompositionExclusions.txt IndicPositionalCategory.txt IndicSyllabicCategory.txt ArabicShaping.txt BidiBrackets.txt BidiMirroring.txt Blocks.txt extracted/DerivedEastAsianWidth.txt extracted/DerivedBidiClass.txt VerticalOrientation.txt'
|
||||
|
||||
if test ! -d ucd/extracted; then
|
||||
mkdir -p ucd/extracted
|
||||
fi
|
||||
|
||||
cd ucd/
|
||||
|
||||
for file in $files
|
||||
do
|
||||
if [ -f $file ]; then
|
||||
echo "$file exists, skipping"
|
||||
else
|
||||
echo "Fetching $url$file"
|
||||
wget -O $file $url$file
|
||||
fi
|
||||
done
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
ARABICSHAPING=ucd/ArabicShaping.txt
|
||||
UNICODEDATA=ucd/UnicodeData.txt
|
||||
|
||||
LAMclass="(`grep '; LAM$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
|
||||
ALEFclass="(`grep '; ALEF$' "$ARABICSHAPING" | cut -d';' -f1 | sort | tr '\n' '|' | sed 's/|$//'`)"
|
||||
|
||||
grep -E ";<(final|isolated)> $LAMclass $ALEFclass;" "$UNICODEDATA"
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+284
File diff suppressed because it is too large
Load Diff
Executable
+270
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,21 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copied from HarfBuzz
|
||||
# https://github.com/harfbuzz/harfbuzz
|
||||
# On 2019-03-07
|
||||
#
|
||||
# Revised by Vincent Wei for MiniGUI 3.4
|
||||
|
||||
from __future__ import print_function, division, absolute_import
|
||||
import sys
|
||||
import os.path
|
||||
from collections import OrderedDict
|
||||
|
||||
if len (sys.argv) != 2:
|
||||
print("usage: ./gen-emoji-table.py emoji-data.txt", file=sys.stderr)
|
||||
sys.exit (1)
|
||||
#if len (sys.argv) != 2:
|
||||
# print("usage: ./gen-emoji-table.py emoji/emoji-data.txt", file=sys.stderr)
|
||||
# sys.exit (1)
|
||||
|
||||
f = open(sys.argv[1])
|
||||
f = open('emoji/emoji-data.txt')
|
||||
header = [f.readline () for _ in range(10)]
|
||||
|
||||
ranges = OrderedDict()
|
||||
@@ -32,39 +38,37 @@ for line in f.readlines():
|
||||
else:
|
||||
ranges[typ].append((start, end))
|
||||
|
||||
|
||||
|
||||
print("/* == Start of generated table == */")
|
||||
print("/*")
|
||||
print(" * The following tables are generated by running:")
|
||||
print(" *")
|
||||
print(" * ./gen-emoji-table.py emoji-data.txt")
|
||||
print(" * ./gen-emoji-table.py")
|
||||
print(" *")
|
||||
print(" * on file with this header:")
|
||||
print(" * on emoji/emoji-data.txt file with this header:")
|
||||
print(" *")
|
||||
for l in header:
|
||||
print(" * %s" % (l.strip()))
|
||||
print(" */")
|
||||
print()
|
||||
print("#ifndef UNICODE_EMOJI_TABLE_H")
|
||||
print("#define UNICODE_EMOJI_TABLE_H")
|
||||
print("#ifndef _MGFONT_UNICODE_EMOJI_TABLES_H")
|
||||
print("#define _MGFONT_UNICODE_EMOJI_TABLES_H")
|
||||
print()
|
||||
print("struct Interval {\n Uchar32 start, end;\n};")
|
||||
|
||||
for typ,s in ranges.items():
|
||||
if typ not in ['emoji',
|
||||
'emoji_presentation',
|
||||
'emoji_modifier',
|
||||
'emoji_modifier_base',
|
||||
'extended_pictographic']: continue
|
||||
if typ not in ['Emoji',
|
||||
'Emoji_Presentation',
|
||||
'Emoji_Modifier',
|
||||
'Emoji_Modifier_Base',
|
||||
'Extended_Pictographic']: continue
|
||||
print()
|
||||
print("static const struct Interval _unicode_%s_table[] =" % typ)
|
||||
print("static const struct Interval _unicode_%s_table[] =" % typ.lower())
|
||||
print("{")
|
||||
for pair in sorted(s):
|
||||
print(" {0x%04X, 0x%04X}," % pair)
|
||||
print("};")
|
||||
|
||||
print()
|
||||
print("#endif /* UNICODE_EMOJI_TABLE_H */")
|
||||
print("#endif /* _MGFONT_UNICODE_EMOJI_TABLES_H */")
|
||||
print()
|
||||
print("/* == End of generated table == */")
|
||||
|
||||
Executable
+270
File diff suppressed because it is too large
Load Diff
Executable
+128
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Wrotten by Vincent Wei for MiniGUI 3.4
|
||||
# Create on 2019-03-07
|
||||
|
||||
from __future__ import print_function, division, absolute_import
|
||||
|
||||
import io, sys
|
||||
|
||||
CHAR_STOP = 0xFF
|
||||
NR_UNICODE_CHARS = CHAR_STOP + 1
|
||||
|
||||
#if len (sys.argv) != 4:
|
||||
# print ("usage: ./gen-sbc-bidi-tables.py", file=sys.stderr)
|
||||
# sys.exit (1)
|
||||
|
||||
filenames = ['ucd/UnicodeData.txt']
|
||||
|
||||
files = [io.open (x, encoding='utf-8') for x in filenames]
|
||||
|
||||
headers = []
|
||||
headers.insert (0, ["UnicodeData.txt does not have a header."])
|
||||
|
||||
# Read fileds[] in UnicodeData.txt to data
|
||||
|
||||
data = [{} for f in files]
|
||||
for i, f in enumerate (files):
|
||||
for line in f:
|
||||
|
||||
j = line.find ('#')
|
||||
if j >= 0:
|
||||
line = line[:j]
|
||||
|
||||
fields = [x.strip () for x in line.split (';')]
|
||||
if len (fields) == 1:
|
||||
continue
|
||||
|
||||
u = int (fields[0], 16)
|
||||
if u > CHAR_STOP:
|
||||
break;
|
||||
|
||||
data[i][u] = fields[4]
|
||||
|
||||
bidi_types = ["BIDI_TYPE_LTR" for i in range(0, NR_UNICODE_CHARS)]
|
||||
|
||||
# Fill bidi_types
|
||||
d = data[0]
|
||||
for u, v in d.items():
|
||||
v = v.strip()
|
||||
if cmp(v, 'L') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_LTR'
|
||||
elif cmp(v, 'R') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_RTL'
|
||||
elif cmp(v, 'EN') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_EN'
|
||||
elif cmp(v, 'ES') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_ES'
|
||||
elif cmp(v, 'ET') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_ET'
|
||||
elif cmp(v, 'AN') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_AN'
|
||||
elif cmp(v, 'CS') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_CS'
|
||||
elif cmp(v, 'B') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_BS'
|
||||
elif cmp(v, 'S') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_SS'
|
||||
elif cmp(v, 'WS') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_WS'
|
||||
elif cmp(v, 'ON') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_ON'
|
||||
elif cmp(v, 'BN') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_BN'
|
||||
elif cmp(v, 'NSM') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_NSM'
|
||||
elif cmp(v, 'AL') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_AL'
|
||||
elif cmp(v, 'LRO') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_LRO'
|
||||
elif cmp(v, 'RLO') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_RLO'
|
||||
elif cmp(v, 'LRE') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_LRE'
|
||||
elif cmp(v, 'RLE') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_RLE'
|
||||
elif cmp(v, 'PDF') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_PDF'
|
||||
elif cmp(v, 'LRI') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_LRI'
|
||||
elif cmp(v, 'RLI') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_RLI'
|
||||
elif cmp(v, 'FSI') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_FSI'
|
||||
elif cmp(v, 'PDI') == 0:
|
||||
bidi_types[u] = 'BIDI_TYPE_PDI'
|
||||
else:
|
||||
print ("Unknown BIDI type: %s" % v)
|
||||
|
||||
print ("/* == Start of generated table == */")
|
||||
print ("/*")
|
||||
print (" * The following table is generated by running:")
|
||||
print (" *")
|
||||
print (" * ./gen-ascii-bidi-tables.py")
|
||||
print (" *")
|
||||
print (" * on ucd/UnicodeData.txt files with these headers:")
|
||||
print (" *")
|
||||
for h in headers:
|
||||
for l in h:
|
||||
print (" * %s" % (l.strip()))
|
||||
print (" */")
|
||||
print ()
|
||||
|
||||
print ("#ifndef _MGFONT_ISO8859_BIDI_TABLES_H")
|
||||
print ("#define _MGFONT_ISO8859_BIDI_TABLES_H")
|
||||
print ("")
|
||||
print ("static const BidiType __mg_iso8859_1_bidi_char_type_map[] =")
|
||||
print ("{")
|
||||
|
||||
for i in range(0, 0x100, 4):
|
||||
print (" %s, %s, %s, %s," % (bidi_types[i], bidi_types[i + 1], bidi_types[i + 2], bidi_types[i + 3], ))
|
||||
|
||||
print ("};")
|
||||
print ()
|
||||
print ("#endif /* !_MGFONT_ISO8859_BIDI_TABLES_H */")
|
||||
|
||||
print ()
|
||||
print ("/* == End of generated table == */")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,181 @@
|
||||
/* MGBidi
|
||||
* gen-unicode-version.c - generate unicode-version.h
|
||||
*
|
||||
* Revised from FriBidi by Vincent Wei for MiniGUI 3.4.0
|
||||
*
|
||||
* Authors of FriBidi:
|
||||
* Behdad Esfahbod, 2001, 2002, 2004
|
||||
*
|
||||
* Copyright (C) 2004 Sharif FarsiWeb, Inc
|
||||
* Copyright (C) 2004 Behdad Esfahbod
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this library, in a file named COPYING; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA
|
||||
*
|
||||
* For licensing issues, contact <fribidi.license@gmail.com>.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "packtab.h"
|
||||
|
||||
#define appname "gen-unicode-version"
|
||||
#define outputname "unicode-version.h"
|
||||
|
||||
static void
|
||||
die (
|
||||
const char *msg
|
||||
)
|
||||
{
|
||||
fprintf (stderr, appname ": %s\n", msg);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static void
|
||||
die2 (
|
||||
const char *fmt,
|
||||
const char *p
|
||||
)
|
||||
{
|
||||
fprintf (stderr, appname ": ");
|
||||
fprintf (stderr, fmt, p);
|
||||
fprintf (stderr, "\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
int version_major, version_minor, version_micro;
|
||||
char unicode_version[100];
|
||||
char buf[4000];
|
||||
|
||||
static void
|
||||
init (
|
||||
void
|
||||
)
|
||||
{
|
||||
version_major = version_minor = version_micro = 0;
|
||||
strcpy (unicode_version, "(unknown)");
|
||||
}
|
||||
|
||||
#define READ_VERSION(prefix) ((where = strstr(buf, prefix)) && \
|
||||
(3 == sscanf (where, \
|
||||
prefix"%d.%d.%d", &version_major, &version_minor, &version_micro)))
|
||||
|
||||
static int
|
||||
read_file (
|
||||
FILE *f
|
||||
)
|
||||
{
|
||||
int found = 0;
|
||||
|
||||
version_micro = 0;
|
||||
|
||||
while (fgets (buf, sizeof buf, f))
|
||||
{
|
||||
const char *where;
|
||||
|
||||
if (READ_VERSION ("Version ") || READ_VERSION ("Unicode "))
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return 0;
|
||||
|
||||
sprintf (unicode_version, "%d.%d.%d", version_major, version_minor,
|
||||
version_micro);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
read_data (
|
||||
const char *data_file_type,
|
||||
const char *data_file_name
|
||||
)
|
||||
{
|
||||
FILE *f;
|
||||
int status;
|
||||
|
||||
if (!(f = fopen (data_file_name, "rt")))
|
||||
die2 ("error: cannot open `%s' for reading", data_file_name);
|
||||
|
||||
status = read_file (f);
|
||||
|
||||
fclose (f);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
gen_unicode_version (
|
||||
const char *data_file_type
|
||||
)
|
||||
{
|
||||
printf ("/* " outputname "\n * generated by " appname "\n" " * from the file %s */\n\n", data_file_type);
|
||||
|
||||
printf ("#define UNIBIDI_UNICODE_VERSION \"%s\"\n"
|
||||
"#define UNIBIDI_UNICODE_MAJOR_VERSION %d\n"
|
||||
"#define UNIBIDI_UNICODE_MINOR_VERSION %d\n"
|
||||
"#define UNIBIDI_UNICODE_MICRO_VERSION %d\n"
|
||||
"\n",
|
||||
unicode_version,
|
||||
version_major, version_minor, version_micro);
|
||||
|
||||
printf ("/* End of generated " outputname " */\n");
|
||||
}
|
||||
|
||||
int
|
||||
main (
|
||||
int argc,
|
||||
const char **argv
|
||||
)
|
||||
{
|
||||
const char *data_file_type;
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
if (argc < 2)
|
||||
die ("usage:\n " appname
|
||||
" /path/to/a/UCD/file [/path/to/more/UCD/files ...]");
|
||||
|
||||
{
|
||||
const char *data_file_name;
|
||||
|
||||
init ();
|
||||
for (i = 1; i < argc && !found; i++)
|
||||
{
|
||||
data_file_name = argv[i];
|
||||
data_file_type = strrchr (data_file_name, '/');
|
||||
if (data_file_type)
|
||||
data_file_type++;
|
||||
else
|
||||
data_file_type = data_file_name;
|
||||
found = read_data (data_file_type, data_file_name);
|
||||
}
|
||||
if (!found)
|
||||
die ("error: version not found");
|
||||
gen_unicode_version (data_file_type);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Executable
+219
File diff suppressed because it is too large
Load Diff
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/en/about/licensing-policy/>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int gbk_index (unsigned short encoding)
|
||||
{
|
||||
unsigned char ch1, ch2;
|
||||
|
||||
ch1 = encoding >> 8;
|
||||
ch2 = (unsigned char)encoding;
|
||||
|
||||
if (ch2 > 0x7F)
|
||||
return (ch1 - 0x81) * 190 + (ch2 - 0x41);
|
||||
else
|
||||
return (ch1 - 0x81) * 190 + (ch2 - 0x40);
|
||||
}
|
||||
|
||||
static struct _font_info {
|
||||
char name [256];
|
||||
int def_char;
|
||||
int pixel;
|
||||
int ascent;
|
||||
int descent;
|
||||
int nr_chars;
|
||||
} font_info;
|
||||
|
||||
typedef struct _glyph {
|
||||
int encoding;
|
||||
int dwidth;
|
||||
int bbw;
|
||||
int bbh;
|
||||
int bbx;
|
||||
int bby;
|
||||
unsigned char bitmap [72];
|
||||
} glyph_t;
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
FILE* fp;
|
||||
int i;
|
||||
int width, height;
|
||||
int bmp_pitch, bmp_size, bmp_pos;
|
||||
|
||||
if (argc < 2) {
|
||||
printf ("usage: ./makegbkrbf <rbfname> < <dumpedbdf.txt>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
scanf ("%s\n", font_info.name);
|
||||
scanf ("%d\n", &font_info.def_char);
|
||||
scanf ("%d\n", &font_info.pixel);
|
||||
scanf ("%d\n", &font_info.ascent);
|
||||
scanf ("%d\n", &font_info.descent);
|
||||
scanf ("%d\n", &font_info.nr_chars);
|
||||
|
||||
width = font_info.pixel;
|
||||
height = font_info.ascent + font_info.descent;
|
||||
bmp_pitch = (width + 7)/8;
|
||||
bmp_size = bmp_pitch * height;
|
||||
|
||||
if ((fp = fopen (argv[1], "w+")) == NULL)
|
||||
return 1;
|
||||
|
||||
printf ("font: %s (%dx%d)\n", font_info.name, width, height);
|
||||
|
||||
fseek (fp, (0xFF - 0x80) * 190 * bmp_size - 1, SEEK_SET);
|
||||
fwrite (" ", 1, 1, fp);
|
||||
|
||||
for (i = 0; i < font_info.nr_chars; i++) {
|
||||
glyph_t glyph;
|
||||
int n, j, k, skip_lines, skip_bytes;
|
||||
int bb_pitch;
|
||||
unsigned char bb_bmp [72];
|
||||
unsigned int bb_lines [24];
|
||||
|
||||
scanf ("%d\n", &glyph.encoding);
|
||||
scanf ("%d\n", &glyph.dwidth);
|
||||
scanf ("%d\n", &glyph.bbw);
|
||||
scanf ("%d\n", &glyph.bbh);
|
||||
scanf ("%d\n", &glyph.bbx);
|
||||
scanf ("%d\n", &glyph.bby);
|
||||
|
||||
printf ("enconding: %d (%d, %d, %d, %d)\n",
|
||||
glyph.encoding, glyph.bbw, glyph.bbh, glyph.bbx, glyph.bby);
|
||||
|
||||
bb_pitch = (glyph.bbw + 7)/8;
|
||||
n = bb_pitch * glyph.bbh;
|
||||
|
||||
/* read bounding box bitmap */
|
||||
for (j = 0; j < n; j++) {
|
||||
int tmp;
|
||||
scanf ("%d\n", &tmp);
|
||||
bb_bmp [j] = (unsigned char)tmp;
|
||||
}
|
||||
|
||||
for (j = 0; j < glyph.bbh; j++) {
|
||||
bb_lines [j] = 0;
|
||||
for (k = 0; k < bb_pitch; k++)
|
||||
bb_lines [j] |= bb_bmp [j*bb_pitch + k] << ((bb_pitch - k - 1) * 8);
|
||||
|
||||
bb_lines [j] <<= (bmp_pitch - bb_pitch) * 8;
|
||||
bb_lines [j] >>= glyph.bbx;
|
||||
}
|
||||
|
||||
skip_lines = height - (glyph.bbh + glyph.bby) - font_info.descent;
|
||||
skip_bytes = skip_lines * bmp_pitch;
|
||||
|
||||
memset (glyph.bitmap, 0, 72);
|
||||
for (j = 0; j < glyph.bbh; j++) {
|
||||
unsigned char* bmp = &glyph.bitmap [skip_bytes + j*bmp_pitch];
|
||||
for (k = 0; k < bmp_pitch; k++)
|
||||
bmp [k] = (unsigned char)(bb_lines [j] >> ((bmp_pitch - k - 1) * 8));
|
||||
}
|
||||
|
||||
bmp_pos = bmp_size * gbk_index (glyph.encoding);
|
||||
|
||||
fseek (fp, bmp_pos, SEEK_SET);
|
||||
fwrite (glyph.bitmap, bmp_size, 1, fp);
|
||||
}
|
||||
|
||||
fclose (fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user