Compare commits

..
320 Commits
Author SHA1 Message Date
Vincent Wei 2b01f35cac rename: LayoutInfo -> Layout, TextRunsInfo -> TextRuns 2019-04-06 11:25:21 +08:00
Vincent Wei e0b6a64402 tune position for west gravity 2019-04-04 19:00:45 +08:00
Vincent Wei 084d7e58a2 tune indentation 2019-04-04 18:53:37 +08:00
Vincent Wei 88753a5fd0 cleanup 2019-04-04 17:02:06 +08:00
Vincent Wei b739daadba cleanup FreeType2 font engine, remove redundant code 2019-04-04 16:51:54 +08:00
Vincent Wei 5529ab1e10 use mg_slice for TEXTRUNS, TEXTLAYOUT, GlyphRun, TextRun, LayoutRun, and so on 2019-04-04 15:10:19 +08:00
Vincent Wei 032fdcc3bb mg_slice_free -> mg_slice_delete; mg_slice_free1 -> mg_slice_free 2019-04-04 14:46:05 +08:00
Vincent Wei 1cb9922dad Initialize mutex of mgslice 2019-04-04 12:27:05 +08:00
Vincent Wei 8ac0d539d0 implementation of mg_slice_xxx 2019-04-04 12:18:10 +08:00
Vincent Wei e3ae994212 debug: line->nr_runs should be re-caculate for ellipsized line 2019-04-04 08:39:09 +08:00
Vincent Wei b0145a15d2 CalcLayoutBoundingRect 2019-04-03 19:13:27 +08:00
Vincent Wei 9dab380f3e GetLayoutLineRect 2019-04-03 19:01:19 +08:00
Vincent Wei d1facd5468 No shaping arabic for vertical layout 2019-04-03 15:50:32 +08:00
Vincent Wei 5996ede23b cleanup 2019-04-03 15:26:50 +08:00
Vincent Wei 837cd49045 debug: uninitialized length 2019-04-03 15:16:07 +08:00
Vincent Wei dc4f54ffe4 debug: uninitialized length 2019-04-03 15:15:39 +08:00
Vincent Wei f611fe3859 normal, word break and alignment 2019-04-03 12:27:10 +08:00
Vincent Wei 4ff5097dfb check pointer for get_glyph_advance 2019-04-02 19:00:13 +08:00
Vincent Wei 49421e1f88 implementation of DrawLayoutLine 2019-04-02 18:46:34 +08:00
Vincent Wei 6e33602e7d debug for glyph orientation in vertical layout 2019-04-02 17:27:15 +08:00
Vincent Wei d13c31a08a add ta (text align) to RENDERDATA 2019-04-02 12:36:31 +08:00
Vincent Wei 704b6287ff debug for MIXED orientation 2019-04-02 10:12:31 +08:00
Vincent Wei 1df726dd10 tune gravity and orientation 2019-04-02 09:27:06 +08:00
Vincent Wei b2afe815b5 debug DrawShapedGlyph 2019-04-01 19:12:41 +08:00
Vincent Wei f648c1a8c7 tune api desc 2019-04-01 14:37:09 +08:00
Vincent Wei 4d2fe61e52 remove (x,y) from CB_GLYPH_LAID_OUT 2019-04-01 14:26:56 +08:00
Vincent Wei 9644964e9c tune api description 2019-03-31 15:31:49 +08:00
Vincent Wei 61b799af88 fix bug: not convert AChar to Glyph32 2019-03-29 20:18:26 +08:00
Vincent Wei 2f52006cde fix a bug: no MSG_IDLE when using dummy IAL engine 2019-03-29 19:22:31 +08:00
Vincent Wei cf063aad32 disable debug print 2019-03-29 18:31:23 +08:00
Vincent Wei 0855e8b972 add null fonts for korea and japanese charsets 2019-03-29 16:13:16 +08:00
Vincent Wei a501557532 Tune CB_GLYPH_LAID_OUT 2019-03-29 14:51:57 +08:00
Vincent Wei 820d6aeac4 fix a bug 2019-03-29 12:27:04 +08:00
Vincent Wei 215242e3e8 tune 2019-03-29 12:14:19 +08:00
Vincent Wei c79f09fe87 implementation of GetLayoutLineSize and CalcLayoutBoundingRect 2019-03-29 11:44:29 +08:00
Vincent Wei f68c26860a Implementation of CreateLogFontForMChar2UChar; FONT_MIN_SIZE -> 1 2019-03-29 10:40:35 +08:00
Vincent Wei 53f1a05526 Tune new APIs 2019-03-29 10:09:23 +08:00
Vincent Wei 6a5cfd1052 new APIs: SetFontNameInTextRuns, SetTextColorInTextRuns, SetBackgroundColorInTextRuns, and GetXXXX 2019-03-28 18:57:21 +08:00
Vincent Wei 1c79cf510f Tune the TextRunsInfo and LayoutInfo related APIs 2019-03-28 17:47:12 +08:00
Vincent Wei 86965a0e9c fixbug in layout-ellipsize.c 2019-03-28 11:40:58 +08:00
Vincent Wei 9cca87878c tune CB_GLYPH_LAID_OUT 2019-03-27 19:28:19 +08:00
Vincent Wei 2cffa1154c API description 2019-03-27 19:16:33 +08:00
Vincent Wei 9adea7df64 implementation of NULL font engine and incored NULL devfonts for every charset 2019-03-27 17:58:56 +08:00
Vincent Wei 8f70dfcf69 UStrTailorBreaks 2019-03-27 16:46:42 +08:00
Vincent Wei ccf1e6f7a5 cleanup 2019-03-27 15:52:43 +08:00
Vincent Wei 913ea4db23 CreateTextRunsInfo and CreateLayoutInfo passed test cases 2019-03-27 15:50:16 +08:00
Vincent Wei 55baa8c741 cleanup 2019-03-27 12:39:27 +08:00
Vincent Wei db63d8cad3 cleanup 2019-03-27 11:40:34 +08:00
Vincent Wei 338fb0276e use _DEBUG for real output of _DBG_PRINTF 2019-03-27 10:08:01 +08:00
Vincent Wei 8dd64e7f2d api description 2019-03-26 19:14:05 +08:00
Vincent Wei c1cbb8423e parameters of CB_GLYPH_LAID_OUT 2019-03-26 18:44:05 +08:00
Vincent Wei a95ee5b181 debug 2019-03-26 18:09:49 +08:00
Vincent Wei 9d9bf95c21 cleanup 2019-03-26 12:25:08 +08:00
Vincent Wei ed6ceaa49c fixbug of layout implementation 2019-03-26 12:22:26 +08:00
Vincent Wei f5e1144cbe debug LayoutInfo implementaion 2019-03-26 11:24:31 +08:00
Vincent Wei c890e4296a add list_concat, list_move, list_reverse 2019-03-26 11:24:06 +08:00
Vincent Wei d09313407e reorder glyph runs according to embedding levels 2019-03-25 15:31:03 +08:00
Vincent Wei 7dfe5954f5 go on 2019-03-25 12:15:23 +08:00
Vincent Wei 390c5de6ef go on 2019-03-24 19:14:46 +08:00
Vincent Wei 274fdaaa31 go on 2019-03-24 19:00:15 +08:00
Vincent Wei 04725fc892 cleanup 2019-03-24 15:46:40 +08:00
Vincent Wei 4da29f635d Use CamelCase for internal structures and types 2019-03-24 15:32:08 +08:00
Vincent Wei 3e5ff0af91 tune implementation 2019-03-24 12:35:31 +08:00
Vincent Wei 1820e74b77 empty implementation 2019-03-22 18:42:08 +08:00
Vincent Wei 2278c4975c new file for ellipsisi 2019-03-22 18:34:11 +08:00
Vincent Wei af8a04570d more code 2019-03-22 18:33:37 +08:00
Vincent Wei 452edfa831 more code for layout 2019-03-22 12:33:53 +08:00
Vincent Wei 4fba705082 cleanup 2019-03-22 10:53:50 +08:00
Vincent Wei a049e387e0 some code for layout 2019-03-22 09:40:05 +08:00
Vincent Wei c67a18536d some code for layout 2019-03-21 19:12:52 +08:00
Vincent Wei d9e09ac34f Intent to add new APIs: DrawShapedGlyph and DrawShapedGlyphLine 2019-03-21 15:28:30 +08:00
Vincent Wei 65972861a0 bugfixs 2019-03-21 15:03:04 +08:00
Vincent Wei 96b06544b3 Optimize FreeType2 engine for get_glyph_advance; add new devfont op: get_kerning 2019-03-21 11:01:37 +08:00
Vincent Wei 838530d6b1 add new internal header: glyph.h; _font_get_glyph_log_width 2019-03-21 09:46:20 +08:00
Vincent Wei c276122f60 Start to implement InitBasicShapingEngine 2019-03-20 18:53:06 +08:00
Vincent Wei 46a8b1768a cleanup 2019-03-20 17:08:43 +08:00
Vincent Wei d5b57e8200 cleanup and add _WRN_PRINTF for warning 2019-03-20 17:06:43 +08:00
Vincent Wei ee179e6995 API description related to LAYOUTINFO 2019-03-20 16:31:41 +08:00
Vincent Wei 3571d88f3d use LoadResource for LOGFONTs of text runs 2019-03-19 19:33:11 +08:00
Vincent Wei 8ba346eec5 use logfont name for CreateTextRunsInfo instead of logfont object 2019-03-19 18:43:04 +08:00
Vincent Wei e110cb61f4 fix bugs 2019-03-19 17:14:42 +08:00
Vincent Wei d29aa1d881 Tune name of structure and functions 2019-03-19 15:37:30 +08:00
Vincent Wei 6337f5d6fa cleanup 2019-03-19 11:49:34 +08:00
Vincent Wei 14bfe263a3 Use LanguageCode and ScriptType types for external APIs 2019-03-19 11:48:24 +08:00
Vincent Wei cbd54e0766 add new APIs: ScriptGetGlyphOrientation and ScriptGetWideGlyphOrientation 2019-03-19 10:45:26 +08:00
Vincent Wei ceaec7e3d3 new API: UBidiGetParagraphEmbeddingLevelsAlt, an optimized call 2019-03-18 19:07:53 +08:00
Vincent Wei aab8d6e2c6 Emoji, Script, and Width iterators for Unicode string 2019-03-18 17:32:27 +08:00
Vincent Wei 8a856e5b99 cleanup 2019-03-18 14:30:46 +08:00
Vincent Wei 46f48a0d6c UCharGetVerticalOrientation 2019-03-18 12:42:45 +08:00
Vincent Wei 40fc11f324 gen-vop-tab: tool to generate the vertical orientation property table 2019-03-18 12:32:47 +08:00
Vincent Wei d63fe9849b Tune GlyphRunInfo 2019-03-16 19:12:57 +08:00
Vincent Wei 349f310148 cleanup 2019-03-16 16:28:46 +08:00
Vincent Wei ac60980bc2 tune GlyphRunInfo APIs and cleanup 2019-03-16 16:21:49 +08:00
Vincent Wei e7002ad870 cleanup; new -> new_entry 2019-03-16 11:33:40 +08:00
Vincent Wei 6838a67e7d some minor changes 2019-03-15 18:24:37 +08:00
Vincent Wei 9a8d997f63 new files 2019-03-15 17:13:47 +08:00
Vincent Wei f8b0a89d90 add glyphruninfo.h 2019-03-15 14:47:41 +08:00
Vincent Wei 72f61f17be trim UCHAR prefix from UCharScriptType and UCHAR_SCRIPT_XXXX 2019-03-15 14:46:24 +08:00
Vincent Wei 676dd0e6da cleanup 2019-03-14 19:08:15 +08:00
Vincent Wei 02c7a6e07c add unicode funcs for HarzBuff 2019-03-14 18:36:21 +08:00
Vincent Wei 8f841a0bc0 split shaped-glyph.c into three files 2019-03-14 17:26:14 +08:00
Vincent Wei f218b7b892 add enable option for complex scripts and harzbuff; cleanup options for TTF support (onley FreeType2) 2019-03-14 17:17:09 +08:00
Vincent Wei 1e1dd76fb1 tune interfaces of GetShapedGlyphsXXX 2019-03-14 12:34:21 +08:00
Vincent Wei 4ba0bcd0fe cleanup 2019-03-13 19:05:15 +08:00
Vincent Wei cc9d9f6d42 basic implementation of GetLangScriptFromName and NormalizeScriptType 2019-03-13 18:57:39 +08:00
Vincent Wei 4c9e8138b1 table for lang name to scripts 2019-03-13 18:27:57 +08:00
Vincent Wei f79a1bd86a cleanup 2019-03-13 18:24:56 +08:00
Vincent Wei 211135fbc5 cleanup 2019-03-13 17:52:43 +08:00
Vincent Wei 537b659fc7 tune implementation of GetShapedGlyphsBasic 2019-03-13 17:25:48 +08:00
Vincent Wei 6b45b74e32 return length of break_oppos instead of the number of consumed uchars 2019-03-13 15:05:18 +08:00
Vincent Wei 0ceb5616bf fix memory usage bug of UStrGetBreaks; UStrGetBreaks does not return when it encounters a hard break 2019-03-13 14:33:48 +08:00
Vincent Wei 62f9cf9e48 tune API description 2019-03-13 12:29:01 +08:00
Vincent Wei 6842cd3933 Split GetUCharsAndBreaks into two APIs: GetUCharsUntilParagraphBoundary and UStrGetBreaks 2019-03-13 12:21:45 +08:00
Vincent Wei 2c5ddd93cb add internal api: _unicode_normalize_script 2019-03-12 19:00:30 +08:00
Vincent Wei 64ddca1e2f Add UCharIsArabicVowel 2019-03-12 18:34:47 +08:00
Vincent Wei 9dea317925 cleanup 2019-03-12 17:53:14 +08:00
Vincent Wei a4e8a42707 cleanup 2019-03-12 17:52:06 +08:00
Vincent Wei 005519e7cc Tuen API of GetShapedGlyphsBasic and GetShapedGlyphsComplex 2019-03-12 15:41:57 +08:00
Vincent Wei da7c2175dd cleanup 2019-03-12 12:29:13 +08:00
Vincent Wei c7e6a867f4 cleanup 2019-03-12 11:57:04 +08:00
Vincent Wei 30c6033e8c cleanup 2019-03-12 09:27:11 +08:00
Vincent Wei 5a5d5d3bbb Passed BidiCharacterTest 2019-03-12 09:03:32 +08:00
Vincent Wei bdd75353d2 cleanup 2019-03-11 19:14:35 +08:00
Vincent Wei ce7b9eccca debug 2019-03-11 18:45:46 +08:00
Vincent Wei c66f1a5fa3 cleanup 2019-03-11 16:08:52 +08:00
Vincent Wei ba240cd53b cleanup 2019-03-11 15:55:14 +08:00
Vincent Wei ca9d0200f3 Implementation of UBidiXXX functions 2019-03-11 15:47:48 +08:00
Vincent Wei 5dd2a21919 Description of Bidi APIs 2019-03-11 12:33:42 +08:00
Vincent Wei 11124ef8a0 rename internal apis and cleanup 2019-03-11 11:51:16 +08:00
Vincent Wei e8714be5ef rename macros 2019-03-11 11:33:02 +08:00
Vincent Wei 13341e864c rename files and internal apis 2019-03-11 09:36:36 +08:00
Vincent Wei e1a464b32f cleanup 2019-03-10 18:55:07 +08:00
Vincent Wei a7601d8cfe tune UCD url 2019-03-10 18:31:15 +08:00
Vincent Wei 98ae3a6b35 Restore BidiBracketType 2019-03-10 18:19:21 +08:00
Vincent Wei f82e15ed5e use iso8859-bidi-tables 2019-03-10 18:08:53 +08:00
Vincent Wei 690f5487ab BIDIType to BidiType 2019-03-10 17:31:36 +08:00
Vincent Wei 4e0a9a8d37 two implementations for biditype, bracket and mirror 2019-03-10 16:54:45 +08:00
Vincent Wei c6f1004ba6 cleanup 2019-03-10 14:47:02 +08:00
Vincent Wei a4e9f56c08 cleanup 2019-03-10 14:44:33 +08:00
Vincent Wei d84a7ffbbe Bidi tables 2019-03-10 14:42:36 +08:00
Vincent Wei 11865764da cleanup 2019-03-10 13:21:08 +08:00
Vincent Wei fdc449335d utilities for generating Bidi tables 2019-03-10 13:17:52 +08:00
Vincent Wei 27e508848d new implementation of UNICODE BIDIRECTIONAL ALGORITHM 2019-03-08 20:38:04 +08:00
Vincent Wei cc01ce0bbc new implementation of UNICODE BIDIRECTIONAL ALGORITHM 2019-03-08 20:37:44 +08:00
Vincent Wei 0093ac3edc New APIs: UCHAR2ACHAR, UChar2AChar, UChars2AChars 2019-03-08 14:39:48 +08:00
Vincent Wei 45db7410c0 Update Unicode tables to 12.0.0 2019-03-08 11:52:49 +08:00
Vincent Wei e6df345736 Update LB8a rule to conform Unicode 12.0.0 2019-03-08 11:52:36 +08:00
Vincent Wei e7b05090cd Rename MCHAR_TYPE_XXX to ACHAR_BASIC_XXX; Tune implementation of GetACharType and GetACharBIDIType 2019-03-08 10:17:18 +08:00
Vincent Wei b82128091e add const for keymap data 2019-03-07 19:09:34 +08:00
Vincent Wei adab30261c add const to incore-res data 2019-03-07 18:57:04 +08:00
Vincent Wei 7e0b378475 add const to _cos_tbl, _tag_tbl, and _acos_tbl; add prefix __mg to these global variables 2019-03-07 18:46:42 +08:00
Vincent Wei d1ef9e2598 rename _unicode_is_emoji_extended_pictographic to _unicode_is_extended_pictographic 2019-03-07 17:46:35 +08:00
Vincent Wei 5887668b17 add new API UCharGetBracketType 2019-03-07 17:42:47 +08:00
Vincent Wei e6cb8f272b update Unicode bidi tables 2019-03-07 17:31:15 +08:00
Vincent Wei 90e4ee91fe Tune BIDIType to Uint16 instead of unsigned int 2019-03-07 12:40:37 +08:00
Vincent Wei 83207ca329 Update Unicode data to 11.0.0 2019-03-07 11:46:17 +08:00
Vincent Wei dcd31bed7c Indic shaping table 2019-03-07 11:02:51 +08:00
Vincent Wei 76cf8a02af Arabic shaping tables 2019-03-07 10:20:41 +08:00
Vincent Wei 10d8b43c61 update emoji data tables 2019-03-07 09:55:23 +08:00
Vincent Wei 554b709890 Restore prototype of DrawGlyphStringEx and add DrawShapedGlyphString 2019-03-07 08:55:47 +08:00
Vincent Wei d877e86adc New API description for GetShapedGlyphsBasic, GetShapedGlyphsComplex, GetGlyphsExtentInfo, and GetGlyphsPositionInfo 2019-03-06 17:20:19 +08:00
Vincent Wei c5e5bd01e8 implement get_glyph_value for FreeType2 engine; the glyph value of this devfont is the glyph index of the default CMap 2019-03-06 16:03:00 +08:00
Vincent Wei e3760457c4 GetGlyphsExtentPointEx -> GetGlyphsExtentFromUChars 2019-03-06 14:42:16 +08:00
Vincent Wei c6ed1626f9 cleanup 2019-03-05 19:09:26 +08:00
Vincent Wei b4b18828b2 change GLYPHTYPE_ to CHARTYPE_ 2019-03-05 18:44:39 +08:00
Vincent Wei 36167be7e6 Tune APIs of Achar32 2019-03-05 18:18:54 +08:00
Vincent Wei 4b633c801d Introduce the Mchar32 type, and distinguish glyph and character 2019-03-05 12:27:35 +08:00
Vincent Wei 33fd8a8668 tune TTF cache arguments 2019-03-05 10:50:25 +08:00
Vincent Wei 94f44890a5 tune code to handle auto-italic correctly 2019-03-05 10:42:16 +08:00
Vincent Wei cc7441c4dd add df_slot to get_font_size of DEVFONT operators in order to set scale correctly 2019-03-05 09:16:36 +08:00
Vincent Wei 6fdc0281ba handle whitespace gracefully 2019-03-04 18:08:36 +08:00
Vincent Wei 136a51d9b8 cleanup 2019-03-04 16:47:19 +08:00
Vincent Wei 5e871c486b Tune FS_SLANT_XXX and tune auto bold implementation 2019-03-04 16:30:25 +08:00
Vincent Wei fdd69bf470 fix bug: do not override bitmap size for grey and subpixel glyph 2019-03-04 16:30:17 +08:00
Vincent Wei 10e55b0d4f restore style for TTF cache 2019-03-04 14:37:59 +08:00
Vincent Wei 682c81d636 tune 2019-03-04 11:52:47 +08:00
Vincent Wei 9eb4e54b75 cleanup 2019-03-04 11:39:32 +08:00
Vincent Wei e43bc07a63 tune fontcache functions: use devfont name instead of family and style 2019-03-04 11:37:50 +08:00
Vincent Wei 508130afdc tune 2019-03-03 20:06:07 +08:00
Vincent Wei d60c057dc4 tune load_flags 2019-03-03 20:00:54 +08:00
Vincent Wei 8f5a741af6 tune load_flags 2019-03-03 19:58:29 +08:00
Vincent Wei bee1bc87c4 tune code for size_request of LOGFONT 2019-03-03 19:14:18 +08:00
Vincent Wei 3a9274e9a0 add SIZE* sz for get_glyph_monobmp and get_glyph_graybmp 2019-03-03 18:54:39 +08:00
Vincent Wei 44ee735cd6 fix a bug of is_glyph_exsited (always returns FALSE) 2019-03-03 18:54:14 +08:00
Vincent Wei 2c010cdbeb fix a bug of fontDoesMatchFamily 2019-03-03 16:51:49 +08:00
Vincent Wei a04ae43bdb fix bug of gdiCreateLogFont 2019-03-03 16:43:40 +08:00
Vincent Wei 5c333445c5 tune font styles 2019-03-01 20:01:30 +08:00
Vincent Wei dd93e67a3d tune document 2019-03-01 14:38:48 +08:00
Vincent Wei d886268eee cleanup and check the duplicated fontname of a new devfont 2019-03-01 14:20:46 +08:00
Vincent Wei 090824cb91 bugfix 2019-02-28 19:08:05 +08:00
Vincent Wei 00eb4e363f Enhance LOGFONT to support multiple MBC devfonts (up to 7) 2019-02-28 18:47:44 +08:00
Vincent Wei f73f0786ee remove break_classes argument and add uchars argument for GetGlyphsAndBreaks 2019-02-28 11:50:00 +08:00
Vincent Wei dacc81cf2a Rename UCharGetBreak to UCharGetBreakType; Cleanup and optimization 2019-02-28 09:47:25 +08:00
Vincent Wei 97c6249af5 cleanup: remove definition of DEBUG 2019-02-27 18:47:25 +08:00
Vincent Wei 7ce1fe47ff implementation of character transformation of GetGlyphsAndBreaks; fix a bug of UCharToFullSizeKana 2019-02-27 18:33:32 +08:00
Vincent Wei 8e66bb366e tune word breaks and sentence breaks 2019-02-27 17:56:41 +08:00
Vincent Wei ce7fd6e776 passed all test cases for UAX#14 and UAX#29 2019-02-27 11:37:17 +08:00
Vincent Wei 957f9cbb47 remove break_classes argument from GetGlyphsExtentPointEx 2019-02-26 19:07:37 +08:00
Vincent Wei 2a7e3003bd Rename GetGlyphsByRules to GetGlyphsAndBreaks 2019-02-26 18:47:33 +08:00
Vincent Wei 19cd208a6e support for GB, WB, SB in break_oppos; add emoji tables 2019-02-26 17:59:50 +08:00
Vincent Wei 6a44111a35 cleanup 2019-02-25 17:09:37 +08:00
Vincent Wei fd5d55942b use Uint16 type for break_oppo instead of Uint8 type in order to contain GB, WB, SB flags 2019-02-25 16:42:49 +08:00
Vincent Wei d4e7f048f0 fixbug 2019-02-25 09:12:51 +08:00
Vincent Wei d90c4d5842 cleanup 2019-02-24 18:31:38 +08:00
Vincent Wei 0f562cd39f cleanup 2019-02-24 15:02:16 +08:00
Vincent Wei fb01003c45 use LEN_VBF_NAME instead of LEN_DEVFONT_NAME 2019-02-24 14:56:43 +08:00
Vincent Wei 9bcea02975 cleanup 2019-02-24 13:35:43 +08:00
Vincent Wei c51ae8d1c1 cleanup 2019-02-22 19:11:37 +08:00
Vincent Wei b8a5ad2d73 return NULL when not matched devfont 2019-02-22 19:11:26 +08:00
Vincent Wei 39b8c88d1b new DC attribute: DC_ATTR_WORD_EXTRA 2019-02-22 18:46:23 +08:00
Vincent Wei 1e73f6713a enable cache of freetype2 engine for rotated glyphs 2019-02-22 17:51:41 +08:00
Vincent Wei 97babaa4e2 add size_request in LOGFONT for original requested size 2019-02-22 17:46:13 +08:00
Vincent Wei c6c486f306 almost there 2019-02-22 15:47:20 +08:00
Vincent Wei 338f10b896 debug 2019-02-22 12:39:07 +08:00
Vincent Wei 2353a873a8 debug GetGlyphsExtentPointEx 2019-02-22 10:49:02 +08:00
Vincent Wei 52c539e870 debug 2019-02-21 20:21:02 +08:00
Vincent Wei 64d63a84c5 cleanup and bugfixs 2019-02-21 18:43:14 +08:00
Vincent Wei 3d80d73450 cleanup and bugfixs 2019-02-21 18:38:49 +08:00
Vincent Wei 2e04898fbe fix bugs 2019-02-21 15:56:51 +08:00
Vincent Wei f390e1a091 fix bugs 2019-02-21 15:51:11 +08:00
Vincent Wei 848c1d7ce1 tune 2019-02-21 12:07:02 +08:00
Vincent Wei 0c0becc780 tune 2019-02-21 10:32:16 +08:00
Vincent Wei 0e918da2a4 bugfix: get_ch_width does not check glyph value 2019-02-21 10:32:01 +08:00
Vincent Wei 7f36c339b7 tune 2019-02-20 18:21:17 +08:00
Vincent Wei 871486daab cleanup 2019-02-20 16:41:21 +08:00
Vincent Wei 0cffc8798f Suppress and/or hang spaces and punctations for GetGlyphsExtentPointEx 2019-02-20 16:00:16 +08:00
Vincent Wei 4d4a3901eb TODOs 2019-02-19 18:53:20 +08:00
Vincent Wei 50e95cb461 Initial implementation of GetGlyphsExtentPointEx and DrawGlyphStringEx 2019-02-19 18:38:57 +08:00
Vincent Wei d223edf0ba partial implementation of GetGlyphsExtentPointEx 2019-02-19 17:48:39 +08:00
Vincent Wei 8e88082f07 UCharGetType -> UCharGetCategory 2019-02-19 10:45:49 +08:00
Vincent Wei 5b1762b637 Enhance GetGlyphsByRules to return breaking classes 2019-02-19 09:41:22 +08:00
Vincent Wei 6c83ea4ceb implementation for LBP_NORMAL and LBP_STRICT; both passed all test cases 2019-02-18 18:24:59 +08:00
Vincent Wei 5aa5e75813 UCharBasicType -> UCharGeneralCategory 2019-02-18 12:16:49 +08:00
Vincent Wei 1ba35dcbf6 implementation of WBR_BREAK_ALL and WBR_KEEP_ALL 2019-02-18 11:44:54 +08:00
Vincent Wei 8828824b23 Add BOV_NOTALLOWED_DEFINITELY and BOV_NOTALLOWED_UNCERTAINLY 2019-02-18 09:25:18 +08:00
Vincent Wei e3f2cc22ec tune BIDILogGlyphs2VisGlyphsEx and BIDILogGlyphs2VisGlyphs 2019-02-17 12:56:35 +08:00
Vincent Wei 93aae6782e Tune GetGlyphsByRules and GetGlyphsExtentPointEx 2019-02-17 11:53:35 +08:00
Vincent Wei b746d2927e Partial implementation of GetGlyphsExtentPointEx 2019-02-15 18:07:03 +08:00
Vincent Wei 79e3be705c simplify the interfaces of GetGlyphsExtentPointEx and DrawGlyphStringEx 2019-02-15 11:07:54 +08:00
Vincent Wei a052b7bf55 cleanup BIDI APIs 2019-02-14 19:45:50 +08:00
Vincent Wei 74a84362ca correct some bad names of BIDI-related APIs 2019-02-14 17:27:11 +08:00
Vincent Wei d673008f5a tune API description 2019-02-14 11:52:59 +08:00
Vincent Wei 09c9438de8 tune api description 2019-01-29 17:02:48 +08:00
Vincent Wei 0734180d70 set user_comp_ctxt to be pixel format for default composition operators 2019-01-29 15:43:23 +08:00
Vincent Wei 8ca8deb02d list developers 2019-01-29 10:51:15 +08:00
Vincent Wei 9aa719aeb3 list developers 2019-01-29 10:42:43 +08:00
Vincent Wei 447eebbafc all UNICODE LINE BREAKING ALGORITHM test cases for GetGlyphsByRules passed 2019-01-27 12:45:20 +08:00
Vincent Wei 19f8689a20 almost passed the test cases for GetGlyphsByRules 2019-01-25 21:34:34 +08:00
Vincent Wei 60902f83d5 debug GetGlyphsByRules 2019-01-25 20:42:32 +08:00
Vincent Wei a725acfd5e debug GetGlyphsByRules 2019-01-25 16:14:42 +08:00
Vincent Wei 0191772111 Tune the implementation of UNICODE LINE BREAKING ALGORITHM 2019-01-24 20:17:27 +08:00
Vincent Wei a11cef5f2e push 2019-01-24 18:43:30 +08:00
Vincent Wei cf4c75bcbc almost finished GetGlyphsByRules 2019-01-24 11:31:54 +08:00
Vincent Wei f85801dcbe part implementation of GetGlyphsByRules 2019-01-23 17:08:03 +08:00
Vincent Wei 4e67f8c56b part implementation of GetGlyphsByRules 2019-01-23 14:36:56 +08:00
Vincent Wei 1cfd2fe324 part implementation of GetGlyphsByRules 2019-01-22 10:50:15 +08:00
Vincent Wei 5ef2e0fa42 temp 2019-01-21 17:14:59 +08:00
Vincent Wei 57b71e985c Add UCharGetType, UCharGetBreak, UCharGetBIDIType, and UCharGetMirror for completeness 2019-01-21 16:19:20 +08:00
Vincent Wei d9d76ec59b DrawGlyphStringEx returns BOOL 2019-01-19 18:29:09 +08:00
Vincent Wei 7935883267 GetGlyphsByRules returns line break opportunities 2019-01-19 18:20:55 +08:00
Vincent Wei 0385def7b2 tune 2019-01-19 15:05:53 +08:00
Vincent Wei 565f4b34e5 cleanup 2019-01-19 15:02:55 +08:00
Vincent Wei 70ba8a0420 cleanup 2019-01-19 14:59:12 +08:00
Vincent Wei 4bdbe4a002 tune 2019-01-19 14:53:35 +08:00
Vincent Wei 2c98ef96da tune release notes 2019-01-19 14:24:26 +08:00
Vincent Wei 6663c98787 add CreateLogFontIndirectEx function 2019-01-19 14:21:46 +08:00
Vincent Wei bbf2376f7a fix a potential bug: reserve key when creating logfont by calling CreateLogFontIndirect 2019-01-19 14:04:11 +08:00
Vincent Wei 21ac9f2def add content language and writing system parameters for rendering glyphs for CSS 2019-01-19 13:27:01 +08:00
Vincent Wei a10d28dd11 unicode script and language code 2019-01-19 12:57:34 +08:00
Vincent Wei 856126c72e make GRF_HANGING_PUNC_FIRST and GRF_HANGING_PUNC_LAST as flag bits 2019-01-18 18:07:44 +08:00
Vincent Wei 547fc0059c tune readme 2019-01-18 16:45:23 +08:00
Vincent Wei 195363dc82 use the same table for UCharToFullSizeKana and UCharToSmallKana 2019-01-18 16:24:56 +08:00
Vincent Wei 54288e5687 more API description 2019-01-18 16:15:14 +08:00
Vincent Wei 9d46406a95 some API description 2019-01-18 15:49:10 +08:00
Vincent Wei d365feca5d tune 2019-01-18 14:05:19 +08:00
Vincent Wei f34ac9d0fe UChar32 -> Uchar32; UChar16 -> Uchar16 2019-01-18 13:56:18 +08:00
Vincent Wei 3a02b056ca Tune format 2019-01-18 12:39:23 +08:00
Vincent Wei 1a1e8cf652 Add UCharToFullWidth and UCharToFullSizeKana 2019-01-18 12:37:53 +08:00
Vincent Wei 94feb0ae44 Tune Glyph32 and UChar32 to be unsigned 2019-01-18 11:43:42 +08:00
Vincent Wei 1e1a5edd13 tune 2019-01-18 11:29:35 +08:00
Vincent Wei ae9b14201b make sure the strings are null-terminated (fontDoesMatchFamily) 2019-01-18 09:29:39 +08:00
Vincent Wei 742150d4f1 restore LEN_FONT_NAME 2019-01-17 19:29:14 +08:00
Vincent Wei 03eac03c8c add UCharCanonicalOrdering and others for composition and decomposition 2019-01-17 18:45:22 +08:00
Vincent Wei 8cd6b037ec tuen release notes 2019-01-17 14:59:40 +08:00
Vincent Wei b35e38bdff tune length of devfont name fields; devfont now supports family aliases 2019-01-17 14:55:06 +08:00
Vincent Wei 58275c88e9 call REAL_GLYPH for devfont operators 2019-01-17 12:40:25 +08:00
Vincent Wei 31b43521d0 call REAL_GLYPH for charset operators 2019-01-17 12:14:02 +08:00
Vincent Wei e68ee00b85 rename glyph type macros and glyph type now includes MCHAR_TYPE_XXX for ASCII characters 2019-01-17 11:59:29 +08:00
Vincent Wei 6e54d4a7d7 add macro GLYPH2UCHAR 2019-01-16 20:43:01 +08:00
Vincent Wei 69b1d63569 Rename IsGlyphAlnum, GlyphToUpper to IsUCharAlnum, UCharToTitle and so on 2019-01-16 20:37:56 +08:00
Vincent Wei 817f4063a1 Add UNICODE utilities: IsGlyphAlnum, GlyphToUpper, ... 2019-01-16 20:34:51 +08:00
Vincent Wei c9ec23dc70 empty implementation of glyphs APIs for CSS 2019-01-16 19:27:41 +08:00
Vincent Wei 972085fa56 cleanup 2019-01-16 17:50:21 +08:00
Vincent Wei c2e24b61e3 cleanup 2019-01-16 17:44:48 +08:00
Vincent Wei bd1fb67930 retrive the break type of UNICODE char; upgrade UNICODE tables to 10.0.0 2019-01-16 17:10:50 +08:00
Vincent Wei 0fcedfca08 cleanup 2019-01-16 14:52:12 +08:00
Vincent Wei c39ce7c0b8 cleanup 2019-01-16 12:04:43 +08:00
Vincent Wei 97014ccdc8 cleanup 2019-01-16 12:02:58 +08:00
Vincent Wei 48e7f6e928 cleanup 2019-01-16 11:53:46 +08:00
Vincent Wei 473f9f98ff cleanup 2019-01-16 11:52:56 +08:00
Vincent Wei 95d09a7673 tune and cleanup 2019-01-16 11:43:27 +08:00
Vincent Wei 53253ed101 optimize the font matching algorithm 2019-01-16 10:18:26 +08:00
Vincent Wei 4bd7c0eef4 add mutex for freetype2 font engine (MGRM_THREADS) and remove lock/unlock of __mg_gdi_lock in _font_get_glyph_advance 2019-01-16 10:06:46 +08:00
Vincent Wei 9af71438dd cleanup 2019-01-15 17:02:11 +08:00
Vincent Wei 747894247b tune release notes 2019-01-15 16:18:45 +08:00
Vincent Wei 82033a44dd cleanup and fix the bug of wrong bboxing handling for SUBPIXEL rendering of glyph 2019-01-15 14:50:46 +08:00
Vincent Wei 1c9537fc63 BMP_TYPE_REPLACEKEY for BITMAP; Declaration of GetGlyphsExtentPointEx and DrawGlyphStringEx; cleanup of GLYPHINFO and GLYPHBITMAP 2019-01-15 10:17:25 +08:00
Vincent Wei 612c395c06 Backward compatiblity of CreateLogFont 2019-01-14 10:23:37 +08:00
Vincent Wei 8dc0ee2ade cleanup 2019-01-13 18:56:41 +08:00
Vincent Wei caefd7355a cleanup 2019-01-13 18:36:03 +08:00
Vincent Wei 9ea0e15dba try to match devfont without style 2019-01-13 17:42:27 +08:00
Vincent Wei 83c8984c74 support flipping glyph for subpixel rendering 2019-01-13 16:59:36 +08:00
Vincent Wei 4761333a1a skip null pixels for subpixel 2019-01-13 16:20:08 +08:00
Vincent Wei 8538f29f70 fixbug: No need to make the pitch of FT2 monobitmap is single-byte aligned 2019-01-13 14:21:18 +08:00
Vincent Wei b658413961 cleanup 2019-01-13 13:17:23 +08:00
Vincent Wei bb187f1ee3 cleanup font name and glyph renderer 2019-01-13 13:10:13 +08:00
Vincent Wei ea8ab93bad cleanup 2019-01-12 15:02:56 +08:00
Vincent Wei 9226fcff26 add examples/createlogfontex.c and cleanup examples/createlogfont.c 2019-01-12 14:03:52 +08:00
Vincent Wei 05cf370155 Cleanup LOGFONT styles 2019-01-12 13:55:51 +08:00
Vincent Wei 0d2352884a tune style for LOGFONT 2019-01-11 10:55:55 +08:00
293 changed files with 135829 additions and 29892 deletions
-2
View File
@@ -1,2 +0,0 @@
Beijing FMSoft Technologies Co., Ltd.. (http://www.fmsoft.cn)
+16
View File
@@ -0,0 +1,16 @@
The current main maintainers and/or developers:
* WEI Yongming
As employed engineers of [Beijing FMSoft Technologies Co., Ltd.],
the following people have participated in the development of MiniGUI Core:
* HOU Huihua
* WAN Zheng
* DONG Kai
* DONG Junjie
* YAN Xiaowei
For community contributors, please see RELASENOTES.md documentation.
[Beijing FMSoft Technologies Co., Ltd.]: http://www.fmsoft.cn
+2 -2
View File
@@ -3216,7 +3216,7 @@ alExtra.(xwyan)
* src/gui/lf_flat.c
* src/gui/lf_skin.c
08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_glyph_type to return
08/24: ENHANCEMENT #1: Add a new method for FONTOPS: get_char_type to return
the glyph type the devfont can give us.
* src/include/devfont.h
* src/font/*.c
@@ -4761,7 +4761,7 @@ create_skin_main_window_ex:
* ext/skin/skin.c
05/16. ENHANCEMENT #8: Support for UTF-16LE and UTF-16BE charsets/encodings.
* Change the definition of UChar32 to 'int'.
* Change the definition of Uchar32 to 'int'.
* include/gdi.h
05/16. ENHANCEMENT #11: Support for FreeType2.
+1 -1
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = "MiniGUI API Reference (MiniGUI-Standalone)"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v3.2.0
PROJECT_NUMBER = v3.4.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
+12 -1
View File
@@ -7,6 +7,7 @@ A mature and proven cross-platform GUI system for embedded and smart IoT devices
1. Introduction
1. A brief building instruction
1. New features in version 3.4.x
1. New features in version 3.2.x
1. The runtime modes of MiniGUI
1. History
@@ -146,6 +147,15 @@ For more information, please run
$ ./configure --help
## NEW FEATURES IN VERSION 3.4.x
We introduce some new features in MiniGUI Version 3.4.x:
* The font and UNICODE related APIs are tuned or enhanced,
in order to support HybridOS Foundation C++ Library.
For more information, please refer to RELEASENOTES.md file.
## NEW FEATURES IN VERSION 3.2.x
We introduce some new features in MiniGUI Version 3.2.x:
@@ -202,7 +212,7 @@ clients and the server.
## HISTORY
About ten years have pasted since MiniGUI was initially created at
21 years have pasted since MiniGUI was initially created at
the end of 1998, and now it becomes much reliable and stable.
During the past years, many remarkable changes have taken place in
the MiniGUI project.
@@ -295,6 +305,7 @@ A brief history description of the development progress lay below:
45) Aug., 2017: FMSoft released the latest source code of mDolphin under Apache 2.0.
46) Dec., 2017: FMSoft updated MiniGUI and miniStudio for latest Linux distributions.
47) Feb., 2018: FMSoft released MiniGUI version 3.2.
47) Jun., 2019: FMSoft released MiniGUI version 3.4.
## ABOUT THE AUTHORS
+141 -7
View File
@@ -1,12 +1,146 @@
# Release Notes
## Version 3.2.2
## Version 3.4.0
The MiniGUI development team announces the availability of MiniGUI 3.2.2.
The MiniGUI development team announces the availability of MiniGUI 3.4.0.
All users of MiniGUI are recommended strongly to use this version.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui.
https://github.com/VincentWei/minigui
### What's new in this version
In this version, we mainly enhanced and tuned the APIs of font rendering.
#### Tunning the logical font APIs
The styles of LOGFONT changed.
* Add new rendering style:
1. `FS_RENDER_ANY`: Not specified
1. `FS_RENDER_MONO`:
1. `FS_RENDER_GREY`:
1. `FS_RENDER_SUBPIXEL`:
* Some old styles are deprecated:
1. `FS_WEIGHT_BOOK`; use `FS_RENDER_GREY` instead.
1. `FS_WEIGHT_SUBPIXEL`; use `FS_RENDER_SUBPIXEL` instead.
* Introduced or redefined the weight styles to follow OpenType specification:
1. `FONT_WEIGHT_ANY`: Not specified
1. `FONT_WEIGHT_THIN`: Thin.
1. `FONT_WEIGHT_EXTRA_LIGHT`: Extra light (Ultra Light).
1. `FONT_WEIGHT_LIGHT`: Light.
1. `FONT_WEIGHT_REGULAR`: Regular (Normal).
1. `FONT_WEIGHT_MEDIUM`: Medium.
1. `FONT_WEIGHT_DEMIBOLD`: Demi Bold (Semi Bold)
1. `FONT_WEIGHT_BOLD`: Bold.
1. `FONT_WEIGHT_EXTRA_BOLD`: Extra Bold (Ultra Bold).
1. `FONT_WEIGHT_BLACK`: Black (Heavy).
* Introduce the new decoration styles and replace
`FONT_UNDERLINE_LINE` and `FONT_STRUCKOUT_LINE` with them:
1. `FONT_DECORATE_ANY`: Not specified.
1. `FONT_DECORATE_NONE`: None.
1. `FONT_DECORATE_UNDERLINE`: glyphs are underscored.
1. `FONT_DECORATE_STRUCKOUT`: glyphs are overstruck.
1. `FONT_DECORATE_US`: Both `FONT_DECORATE_UNDERLINE` and `FONT_DECORATE_STRUCKOUT`.
1. `FONT_DECORATE_OUTLINE`: Outline (hollow) glyphs.
1. `FONT_DECORATE_REVERSE`: Reverved for future. Glyphs have their foreground and background reversed.
* The following style are deprecated:
1. `FONT_OTHER_LCDPORTRAIT`
1. `FONT_OTHER_LCDPORTRAITKERN`
For a new app, you should use the new function `CreateLogFontEx` to
create a LOGFONT, and specify the weight and rendering method of the glyph.
For the back-compatibility, you can still use `CreateLogFont` to create a new
LOGFONT. However, `FS_WEIGHT_BOOK` will be treated `FS_WEIGHT_REGULAR` and
`FS_RENDER_GREY`, while `FS_WEIGHT_SUBPIXEL` will be treated
`FS_WEIGHT_REGULAR` and `FS_RENDER_SUBPIXEL`.
You can still use `CreateLogFontByName` to create a new LOGFONT.
But the style string in the font name changed from
<weight><slant><flipping><other><underline><struckout>
to
<weight><slant><flipping><other><decoration><rendering>
Note that `<underline>` and `<struckout>` are merged to `<decoration>`
in order to keep the style string is still 6-character long.
Consequently, if you want to use the rendering method SUPIXEL for a TTF font,
please define the logical font name in the following way:
ttf-Courier-rrncns-*-16-UTF-8
Moreover, the family name of a DEVFONT supports aliases since 3.4.0:
<fonttype>-<family[,aliase]*>-<styles>-<width>-<height>-<charset[,charset]*>
for example:
ttf-Arial,Sans Serif-rrncnn-8-16-ISO8859-1,UTF-8
ttf-courier,monospace,serif-rrncnn-8-16-ISO8859-1,UTF-8
Note that the length of one DEVFONT name can not exceed 255 bytes.
#### Changed APIs
* The fields `height` and `descent` have been removed from GLYPHINFO struct.
One should get the font metrics information by calling `GetFontMetrics` function
if you want to get the height and descent data of one font.
* More fields added for GLYPHBITMAP struct in order to return the completed
rasterized glyph bitmap information.
* `GetGlyphInfo` now can return the basic glyph type and break type of a
UNICODE character. If the glyph is an ASCII character, the old `MCHAR_TYPE`
can also be returned.
* Rename `mg_FT_LcdFilter` to `FT2LCDFilter` in order to follow MiniGUI naming
rules.
* Rename `UChar32` to `Uchar32` and `UChar16` to `Uchar16` in order to
avoid the conflict with typedef of UChar32 in 'unicode/umachine.h'.
* Redefine `Uchar32` and `Glyph32` as `Uint32` instead of `int`.
#### New APIs
* `GetGlyphsByRules` function calculates and allocates the glyph string from
a multi-byte string under the specified white space rule and transformation
rule.
* `GetGlyphsExtentPointEx` function gets the visual extent information
of a glyph string which can fit in a line with the specified maximal extent.
* `DrawGlyphStringEx` function draws a glyph string to the specific
positions of a DC.
* `CreateLogFontIndirectEx` creates a new LOGFONT by using the value of
an existed LOGFONT but with a new rotation value.
#### Others
* Support for FreeType1 removed.
You should always use FreeType2 to support vector fonts, such as TrueType
fonts (TTF), TrueType collections (TTC), OpenType fonts (OTF, both TrueType
and CFF variants), OpenType collections (OTC), and Type 1 fonts (PFA and PFB).
### Other Changes
* A new BITMAP type: `BMP_TYPE_REPLACEKEY`. When `bmType` of a BITMAP object
has this bit set, any pixel which is equal to `bmColorKey` will be replaced by
`bmColorRep`.
## Version 3.2.1
The MiniGUI development team announces the availability of MiniGUI 3.2.1.
All users of MiniGUI are recommended strongly to use this version.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui
### What's new in this version
@@ -24,10 +158,10 @@ Please report any bugs and incompatibilities in
1. New API: `UpdateInvalidClient`. You can use this function to update
the invalid client region of a window instantly.
1. Use different colors for the output of `_DBG_PRINTF` and `_ERR_PRINTF`.
1. Add `__mg_save_jpg` function for storing MYBITMAP as JPEG file (10km).
1. Modified logic for checking JPEG format (10km).
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.
@@ -58,7 +192,7 @@ The MiniGUI development team announces the availability of MiniGUI 3.2.0.
All users of MiniGUI are recommended strongly to use this version for new
MiniGUI apps. Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui.
https://github.com/VincentWei/minigui
### What's new in this version
+3 -3
View File
@@ -1,9 +1,9 @@
Version 3.2.0 (2018/02/10)
Version 3.4.0 (2019/06/30)
This release needs the following resource packages:
* minigui-res-3.0.13.tar.gz
* minigui-res-3.4.0.tar.gz
The latest samples package is:
* mg-samples-3.2.0.tar.gz
* mg-samples-3.4.0.tar.gz
+118 -94
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -239,9 +239,9 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
496 static int euckr_is_this_charset (const unsigned char* charset)
497 {
498 int i;
499 char name [LEN_FONT_NAME + 1];
499 char name [LEN_LOGFONT_NAME_FIELD + 1];
500
501 for (i = 0; i &lt; LEN_FONT_NAME + 1; i++) {
501 for (i = 0; i &lt; LEN_LOGFONT_NAME_FIELD + 1; i++) {
502 if (charset [i] == '\0')
503 break;
504 name [i] = toupper (charset [i]);
@@ -388,9 +388,9 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
<table border="0" cellpadding="0" class="code-sample" width="100%"><tr><td> <pre>
228 typedef struct _LOGFONT {
229 char type [LEN_FONT_NAME + 1];
230 char family [LEN_FONT_NAME + 1];
231 char charset [LEN_FONT_NAME + 1];
229 char type [LEN_LOGFONT_NAME_FIELD + 1];
230 char family [LEN_LOGFONT_NAME_FIELD + 1];
231 char charset [LEN_LOGFONT_NAME_FIELD + 1];
232 DWORD style;
233 int size;
234 int rotation;
+12 -12
View File
@@ -1,14 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontbig24;
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
12, 0);
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
24, 0);
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
12, 0);
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
24, 0);
+14
View File
@@ -0,0 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontttf;
logfont = CreateLogFontEx (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
16, 0);
logfontgb12 = CreateLogFontEx (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
12, 0);
logfontttf = CreateLogFontEx ("ttf", "Courier", "UTF-8",
FONT_WEIGHT_BLACK, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FS_OTHER_LCDPORTRAIT, FONT_DECORATE_NONE, FONT_RENDER_SUBPIXEL,
24, 0);
+89 -36
View File
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -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 */
+4772 -800
View File
File diff suppressed because it is too large Load Diff
+321
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -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).
*
+258 -260
View File
File diff suppressed because it is too large Load Diff
+36 -37
View File
@@ -44,21 +44,20 @@
extern "C" {
#endif
typedef struct _GLYPHBUF
typedef struct _ACHARBUF
{
GLYPHMAPINFO* glyph_map; /* glyph info array */
int* glyphs; /* glyph array */
int glyphs_len; /* glyph array len or buffer used size */
ACHARMAPINFO* achar_map; /* achar info array */
Achar32* achars; /* achar array */
int achars_len; /* achar array len or buffer used size */
int blocksize; /* block size, a block is an allocate unit */
int glyphs_buffsize; /* glyph string buffer size */
int glyphmap_buffsize; /* glyph map buffer size */
} GLYPHBUF;
int achars_buffsize; /* achar string buffer size */
int acharmap_buffsize; /* achar map buffer size */
} ACHARBUF;
typedef struct tagBIDISLEDITDATA
{
StrBuffer str_content; // string text buffer
GLYPHBUF glyph_content; // glyph string buffer
ACHARBUF achar_content; // achar string buffer
int editPos; // current edit position
int selStart; // selection start position
@@ -92,48 +91,48 @@ typedef struct tagBIDISLEDITDATA
typedef BIDISLEDITDATA* PBIDISLEDITDATA;
static inline void*
glyphbuf_alloc (GLYPHBUF* glyph_buff, int len, int block_size)
acharbuf_alloc (ACHARBUF* achar_buff, int len, int block_size)
{
glyph_buff->glyphs_buffsize = (len + (block_size - len % block_size))
* sizeof (int);
glyph_buff->glyphs = malloc (glyph_buff->glyphs_buffsize);
achar_buff->achars_buffsize = (len + (block_size - len % block_size))
* sizeof (Achar32);
achar_buff->achars = malloc (achar_buff->achars_buffsize);
glyph_buff->glyphmap_buffsize = (len + (block_size - len % block_size))
* sizeof (GLYPHMAPINFO);
glyph_buff->glyph_map = malloc (glyph_buff->glyphmap_buffsize);
achar_buff->acharmap_buffsize = (len + (block_size - len % block_size))
* sizeof (ACHARMAPINFO);
achar_buff->achar_map = malloc (achar_buff->acharmap_buffsize);
glyph_buff->glyphs_len = len;
glyph_buff->blocksize = block_size;
achar_buff->achars_len = len;
achar_buff->blocksize = block_size;
return glyph_buff->glyphs;
return achar_buff->achars;
}
static inline void glyphbuf_free (GLYPHBUF *glyph_buff)
static inline void acharbuf_free (ACHARBUF *achar_buff)
{
if (glyph_buff) {
free (glyph_buff->glyphs);
free (glyph_buff->glyph_map);
if (achar_buff) {
free (achar_buff->achars);
free (achar_buff->achar_map);
}
}
static inline void* glyphbuf_realloc (GLYPHBUF *glyph_buff, int len)
static inline void* acharbuf_realloc (ACHARBUF *achar_buff, int len)
{
if (len * sizeof(int) > glyph_buff->glyphs_buffsize ||
len * sizeof(int) < glyph_buff->glyphs_buffsize - glyph_buff->blocksize) {
/* realloc glyph string mem */
glyph_buff->glyphs_buffsize = (len + (glyph_buff->blocksize -
len % glyph_buff->blocksize))* sizeof(int);
glyph_buff->glyphs = realloc (glyph_buff->glyphs,
glyph_buff->glyphs_buffsize);
if (len * sizeof(int) > achar_buff->achars_buffsize ||
len * sizeof(int) < achar_buff->achars_buffsize - achar_buff->blocksize) {
/* realloc achar string mem */
achar_buff->achars_buffsize = (len + (achar_buff->blocksize -
len % achar_buff->blocksize))* sizeof(Achar32);
achar_buff->achars = realloc (achar_buff->achars,
achar_buff->achars_buffsize);
/* realloc glyph map mem */
glyph_buff->glyphmap_buffsize = (len + (glyph_buff->blocksize -
len % glyph_buff->blocksize))* sizeof(GLYPHMAPINFO);
glyph_buff->glyph_map = realloc (glyph_buff->glyph_map,
glyph_buff->glyphmap_buffsize);
/* realloc achar map mem */
achar_buff->acharmap_buffsize = (len + (achar_buff->blocksize -
len % achar_buff->blocksize))* sizeof(ACHARMAPINFO);
achar_buff->achar_map = realloc (achar_buff->achar_map,
achar_buff->acharmap_buffsize);
}
return glyph_buff->glyphs;
return achar_buff->achars;
}
BOOL RegisterBIDISLEditControl (void);
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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) {
+1 -1
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+9 -9
View File
@@ -271,30 +271,30 @@ static void set_keyboard_layout(HWND hDlg)
}
#if 0
if (cur_type == GLYPH_TYPE_RTL) {
if (l_glyph_type == GLYPH_TYPE_RTL)
if (cur_type == CHAR_TYPE_RTL) {
if (l_char_type == CHAR_TYPE_RTL)
return INSERTPOS_BEFORE (sled, l_glyph_index);
else if (r_glyph_type == GLYPH_TYPE_RTL)
else if (r_char_type == CHAR_TYPE_RTL)
return INSERTPOS_AFTER (sled, r_glyph_index);
else
{
if (l_glyph_type == GLYPH_TYPE_LTR)
if (l_char_type == CHAR_TYPE_LTR)
return INSERTPOS_AFTER (sled, l_glyph_index);
else if (l_glyph_type == GLYPH_TYPE_LTR)
else if (l_char_type == CHAR_TYPE_LTR)
return INSERTPOS_BEFORE (sled, r_glyph_index);
else
return 0;
}
}
else {
if (l_glyph_type == GLYPH_TYPE_LTR)
if (l_char_type == CHAR_TYPE_LTR)
return INSERTPOS_AFTER (sled, l_glyph_index);
else if (r_glyph_type == GLYPH_TYPE_LTR)
else if (r_char_type == CHAR_TYPE_LTR)
return INSERTPOS_BEFORE (sled, r_glyph_index);
else {
if (l_glyph_type == GLYPH_TYPE_RTL)
if (l_char_type == CHAR_TYPE_RTL)
return INSERTPOS_BEFORE (sled, l_glyph_index);
else if (l_glyph_type == GLYPH_TYPE_RTL)
else if (l_char_type == CHAR_TYPE_RTL)
return INSERTPOS_AFTER (sled, r_glyph_index);
else
return 0;
+3 -3
View File
@@ -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;
}
+2 -2
View File
@@ -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
View File
@@ -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;
+1 -1
View File
@@ -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)
+11 -5
View File
@@ -1458,7 +1458,6 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rctop = rc.top;
if (mouseX <= right && mouseX >= left && (p != pData->pItemSelected) ) {
PLOGFONT logfont;
c = getCountFromItem (pData, pData->pItemSelected);
c = c - pData->nItemTop - 1;
if (c < 0)
@@ -1471,12 +1470,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rc.top += TV_BORDER;
rc.bottom = rc.top + pData->nItemHeight;
/*bugfix: 4864, zhaochengzhang*/
/* VincentWei: do not depend on logfont style
PLOGFONT logfont;
//bugfix: 4864, zhaochengzhang
logfont = GetWindowFont(hwnd);
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
rc.top = rctop + (count - pData->nItemTop - 1) * pData->nItemHeight;
@@ -1484,17 +1486,18 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rc.top += TV_BORDER;
rc.bottom = rc.top + pData->nItemHeight;
/*bugfix: 4864 zhaochengzhang*/
/* VincentWei: do not depend on logfont style
//bugfix: 4864 zhaochengzhang
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
NotifyParent (hwnd, pData->id, TVN_CLICKED);
}
if (mouseX <= left + h && mouseX >= left) {
PLOGFONT logfont;
if (p->child == NULL)
break;
@@ -1519,12 +1522,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
tvSetHScrollInfo (hwnd, pData, TRUE);
rc.bottom = rcClient.bottom;
/*bugfix: 4864 zhaochengzhang*/
/* VincentWei: do not depend on the logfont style
PLOGFONT logfont;
//bugfix: 4864 zhaochengzhang
logfont = GetWindowFont(hwnd);
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
NotifyParent (hwnd, pData->id, TVN_CLICKED);
}
+32 -8
View File
@@ -2,22 +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 \
fontcache.c freetype1.c freetype2.c font-engines.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 \
bitmapfont.c scripteasy.c
textops.c \
mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
bitmapfont.c scripteasy.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 freetype1.h freetype2.h qpf.h \
upf.h bitmapfont.h gunichartables.h se_minigui.h unicode-bidi-tables.h
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-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) $(HB_INC_DIR)
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
libfont_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
+19 -14
View File
@@ -190,7 +190,7 @@ static void destroy (GLYPHTREENODE *root)
/*** device font ops ***/
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
return DEVFONTGLYPHTYPE_PRERDRBMP;
}
@@ -210,8 +210,11 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
return ((BMPFONTINFO *)devfont->data)->height;
}
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect)
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, 1);
return ((BMPFONTINFO *)devfont->data)->height;
}
@@ -271,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;
@@ -365,7 +368,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
/**************************** Global data ************************************/
FONTOPS __mg_bitmap_font_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
@@ -408,7 +411,6 @@ build_bmpfont_info (const char *bmpfont_name, const BITMAP* glyph_bmp,
goto error_load;
}
bmpfont_info->ave_width = glyph_width;
bmpfont_info->max_width = glyph_width;
bmpfont_info->node_cnt = 1;
@@ -441,6 +443,7 @@ error_load:
return NULL;
}
#if 0 // VincentWei: bad implementation
static int set_devfont_style (char* name, char style)
{
int i;
@@ -461,7 +464,7 @@ static int set_devfont_style (char* name, char style)
return 1;
}
#endif
/************************/
DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
@@ -469,7 +472,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
{
DEVFONT* bitmapfont_dev_font = NULL;
CHARSETOPS* charset_ops;
char charset[LEN_FONT_NAME + 1];
char charset[LEN_LOGFONT_NAME_FIELD + 1];
BMPFONTINFO *bmpfont_info;
int offset;
@@ -484,7 +487,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
goto error_create;
}
offset = (charset_ops->char_glyph_value) (NULL, 0,
offset = (charset_ops->get_char_value) (NULL, 0,
(const unsigned char*) start_mchar, 0);
bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp,
@@ -500,15 +503,17 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
return NULL;
}
/*
* Set device name and add BOLD & ITALIC style
*/
strncpy (bitmapfont_dev_font->name ,bmpfont_name, LEN_UNIDEVFONT_NAME);
/*
* Set device name
*/
strncpy (bitmapfont_dev_font->name, bmpfont_name, LEN_UNIDEVFONT_NAME);
#if 0 // VincentWei: bad implementation
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_WEIGHT_BOLD))
return NULL;
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_SLANT_ITALIC))
return NULL;
#endif
bitmapfont_dev_font->name [LEN_UNIDEVFONT_NAME] = '\0';
bitmapfont_dev_font->style = fontConvertStyle (bitmapfont_dev_font->name);
@@ -545,7 +550,7 @@ BOOL AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
return FALSE;
/* Insert a node in the avl tree */
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
(const unsigned char*)start_mchar, 0);
if (look_up (root, offset) == NULL) {
@@ -639,7 +644,7 @@ static int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n)
GLYPHTREENODE *p;
int offset;
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
(const unsigned char*)start_mchar, n);
offset += n;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+305 -1070
View File
File diff suppressed because it is too large Load Diff
+345 -99
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -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
+46 -74
View File
File diff suppressed because it is too large Load Diff
+232 -30
View File
File diff suppressed because it is too large Load Diff
+25 -16
View File
@@ -65,7 +65,7 @@ static TT_Engine ttf_engine; /* The ONLY freetype engine */
static BYTE virtual_palette [] = {0, 32, 64, 128, 255};
/************************ Create/Destroy FreeType font ***********************/
static void* load_font_data (const char* font_name, const char *file_name)
static void* load_font_data (DEVFONT* devfont, const char* font_name, const char *file_name)
{
unsigned short i, n;
unsigned short platform, encoding;
@@ -76,7 +76,7 @@ static void* load_font_data (const char* font_name, const char *file_name)
/* 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 (const char* font_name, const char *file_name)
}
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 (const char* font_name, const char *file_name)
= (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;
@@ -144,7 +144,7 @@ error_after_create_info:
return NULL;
}
static void unload_font_data (void* data)
static void unload_font_data (DEVFONT* devfont, void* data)
{
TTFINSTANCEINFO* ttf_inst_info = (TTFINSTANCEINFO*)data;
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
@@ -243,7 +243,7 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
return kernval;
}
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
if (logfont->style & FS_WEIGHT_BOOK)
return DEVFONTGLYPHTYPE_GREYBMP;
@@ -263,10 +263,13 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
return ttf_inst_info->height;
}
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect)
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect, int df_slot)
{
unsigned short scale = 1;
SET_DEVFONT_SCALE (logfont, devfont, scale);
if (df_slot >= 0 && df_slot < MAXNR_DEVFONTS)
SET_DEVFONT_SCALE (logfont, df_slot, scale);
return expect;
}
@@ -294,7 +297,7 @@ static void start_str_output (LOGFONT* logfont, DEVFONT* devfont)
/* call this function before getting the bitmap/pixmap of the char
* to get the bbox of the char */
static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value,
Glyph32 glyph_value,
int* px, int* py, int* pwidth, int* pheight)
{
TT_UShort uni_char;
@@ -304,6 +307,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
TT_Glyph_Metrics metrics;
TT_BBox bbox;
glyph_value = REAL_GLYPH(glyph_value);
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
@@ -440,12 +444,13 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
/* call this function to get the bitmap/pixmap of the char */
static const void*
char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* pitch, BOOL is_grey)
Glyph32 glyph_value, int* pitch, BOOL is_grey)
{
TT_Raster_Map Raster;
TT_Error error;
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
glyph_value = REAL_GLYPH(glyph_value);
/* now allocate the raster bitmap */
Raster.rows = ttf_inst_info->cur_height;
Raster.width = ttf_inst_info->cur_width;
@@ -538,15 +543,17 @@ char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
}
static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* pitch, unsigned short* scale)
Glyph32 glyph_value, int* pitch, unsigned short* scale)
{
glyph_value = REAL_GLYPH(glyph_value);
if (scale) *scale = 1;
return char_bitmap_pixmap (logfont, devfont, glyph_value, pitch, FALSE);
}
static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* pitch, unsigned short* scale)
Glyph32 glyph_value, int* pitch, unsigned short* scale)
{
glyph_value = REAL_GLYPH(glyph_value);
if (scale) *scale = 1;
return char_bitmap_pixmap (logfont, devfont, glyph_value, pitch, TRUE);
}
@@ -554,12 +561,13 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
/* call this function after getting the bitmap/pixmap of the char
* to get the advance of the char */
static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* px, int* py)
Glyph32 glyph_value, int* px, int* py)
{
TT_Pos vec_x, vec_y;
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
TTFGLYPHINFO* ttf_glyph_info = TTF_GLYPH_INFO_P (devfont);
glyph_value = REAL_GLYPH(glyph_value);
if (ttf_inst_info->rotation) {
vec_x = ttf_inst_info->cur_advance;
vec_y = 0;
@@ -621,7 +629,7 @@ static DEVFONT* new_instance (LOGFONT* logfont, DEVFONT* devfont,
memcpy (new_devfont, devfont, sizeof (DEVFONT));
if (need_sbc_font && devfont->charset_ops->bytes_maxlen_char > 1) {
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
fontGetCompatibleCharsetFromName (devfont->name, charset);
new_devfont->charset_ops = GetCharsetOpsEx (charset);
@@ -754,6 +762,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
glyph_value = REAL_GLYPH(glyph_value);
if(devfont->charset_ops->conv_to_uc32)
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
@@ -771,7 +780,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
}
/**************************** Global data ************************************/
FONTOPS __mg_ttf_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
@@ -811,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
+523 -351
View File
File diff suppressed because it is too large Load Diff
+39 -27
View File
@@ -40,6 +40,12 @@
#ifndef GUI_FREETYP2_H
#define GUI_FREETYP2_H
#ifndef TTF_DBG
#define DP(x)
#else
#define DP(x) do { printf x; } while (0)
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -54,6 +60,7 @@ extern "C" {
#include FT_CACHE_MANAGER_H
#include FT_TRIGONOMETRY_H
#include FT_IMAGE_H
#include FT_TRUETYPE_TABLES_H
#if 0
#define _MGFONT_TTF_CACHE 1
@@ -62,19 +69,17 @@ extern "C" {
#endif
#ifdef _MGFONT_TTF_CACHE
typedef unsigned long HCACHE;
typedef int (* MakeHashKeyFunc)(unsigned short unicode);
typedef void* HCACHE;
typedef int (* MakeHashKeyFunc)(Glyph32 gv);
#endif
typedef struct tagFTFACEINFO {
#ifdef _MGFONT_TTF_CACHE
/*should be MAX_PATH*/
char filepathname[256];
char* filepathname;
int face_index;
int cmap_index;
#else
FT_Face face;
#endif
FT_Face face;
BOOL valid;
} FTFACEINFO, *PFTFACEINFO;
@@ -84,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;
@@ -100,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;
@@ -113,37 +118,44 @@ 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 {
unsigned short unicode;
short glyph_code;
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;
void *bitmap;
} TTFCACHEINFO, *PTTFCACHEINFO;
extern HCACHE __mg_ttc_create(char *family, char *charset, DWORD style, int size,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
extern HCACHE __mg_ttc_create(const char *df_name,
int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
extern HCACHE __mg_ttc_is_exist(const char *df_name,
int style, int size, int rotation);
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,
unsigned short unicode, int *size);
extern HCACHE __mg_ttc_is_exist(char *family, char *charset,
DWORD style, 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
#undef TTF_DBG
#ifndef TTF_DBG
#define DP(x)
#else
#define DP(x) do { printf x; } while (0)
#endif
#ifdef __cplusplus
File diff suppressed because it is too large Load Diff
-201
View File
File diff suppressed because it is too large Load Diff
+157
View File
@@ -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) */
File diff suppressed because it is too large Load Diff
+85
View File
@@ -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
+404 -313
View File
File diff suppressed because it is too large Load Diff
+185
View File
@@ -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
};
+47 -37
View File
File diff suppressed because it is too large Load Diff
+16 -16
View File
@@ -65,11 +65,7 @@
#define RBFONT_INFO(devfont) ((RBFINFO*)(devfont.data))
/********************** Load/Unload of raw bitmap font ***********************/
#if 0
static void* load_font_data (char* font_name, char* file_name,
char* real_font_name)
#endif
static void* load_font_data (const char* font_name, const char* file_name)
static void* load_font_data (DEVFONT* devfont, const char* font_name, const char* file_name)
{
FILE* fp = NULL;
RBFINFO* rbf_info = calloc (1, sizeof(RBFINFO));
@@ -129,7 +125,7 @@ error_load:
/********************** Init/Term of raw bitmap font ***********************/
static void unload_font_data (void* data)
static void unload_font_data (DEVFONT* devfont, void* data)
{
RBFINFO* rbfinfo = (RBFINFO*)data;
#ifdef HAVE_MMAP
@@ -143,7 +139,7 @@ static void unload_font_data (void* data)
/*************** Raw bitmap font operations *********************************/
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
return DEVFONTGLYPHTYPE_MONOBMP;
}
@@ -158,7 +154,7 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
return RBFONT_INFO_P (devfont)->height * GET_DEVFONT_SCALE (logfont, devfont);
}
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect)
static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect, int df_slot)
{
int height = RBFONT_INFO_P (devfont)->height;
unsigned short scale = 1;
@@ -166,7 +162,9 @@ static int get_font_size (LOGFONT* logfont, DEVFONT* devfont, int expect)
if (logfont->style & FS_OTHER_AUTOSCALE)
scale = font_GetBestScaleFactor (height, expect);
SET_DEVFONT_SCALE (logfont, devfont, scale);
if (df_slot >= 0 && df_slot < MAXNR_DEVFONTS) {
SET_DEVFONT_SCALE (logfont, df_slot, scale);
}
return height * scale;
}
@@ -208,13 +206,13 @@ static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont)
}
static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* pitch, unsigned short* scale)
Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale)
{
int bitmap_size;
Glyph32 glyph_tmp = glyph_value;
if (glyph_tmp >= RBFONT_INFO_P (devfont)->nr_glyphs)
glyph_tmp = devfont->charset_ops->def_glyph_value;
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value >= RBFONT_INFO_P (devfont)->nr_glyphs)
glyph_value = devfont->charset_ops->def_char_value;
bitmap_size = ((RBFONT_INFO_P (devfont)->width + 7) >> 3)
* RBFONT_INFO_P (devfont)->height;
@@ -224,12 +222,13 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
if (scale)
*scale = GET_DEVFONT_SCALE (logfont, devfont);
return RBFONT_INFO_P (devfont)->data + bitmap_size * glyph_tmp;
return RBFONT_INFO_P (devfont)->data + bitmap_size * glyph_value;
}
static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont,
Glyph32 glyph_value)
{
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value > RBFONT_INFO_P(devfont)->nr_glyphs)
return FALSE;
else
@@ -241,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;
}
@@ -268,7 +268,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/
FONTOPS __mg_rbf_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_ave_width, // max_width same as ave_width
get_font_height,
File diff suppressed because it is too large Load Diff
+18 -9
View File
@@ -113,7 +113,7 @@ static BOOL load_fonts(void)
se_dev_fonts = calloc (font_table_size, sizeof (DEVFONT));
for (i = 0; i < font_table_size; i++) {
char charset[LEN_FONT_NAME + 1];
char charset[LEN_LOGFONT_NAME_FIELD + 1];
CHARSETOPS *charset_ops;
const char *font_name;
int font_id;
@@ -158,7 +158,7 @@ static BOOL load_fonts(void)
if ((nr_charsets = charsetGetCharsetsNumber (charsets)) > 1) {
int j;
for (j = 1; j < nr_charsets; j++) {
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
CHARSETOPS* charset_ops;
DEVFONT* new_devfont;
@@ -334,6 +334,7 @@ static int get_glyph_width (LOGFONT* logfont, DEVFONT* devfont,
SeLogFont selogfont;
int width;
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -364,7 +365,7 @@ static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
return logfont->size;
}
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
if (logfont->style & FS_WEIGHT_BOOK)
return DEVFONTGLYPHTYPE_GREYBMP;
@@ -440,6 +441,7 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
printf("in get_glyph_greybitmap....\n");
#endif
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -466,7 +468,7 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
}
static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
const Glyph32 glyph_value, int* pitch, unsigned short* scale)
Glyph32 glyph_value, int* pitch, unsigned short* scale)
{
seunichar16 wc;
SeLogFont selogfont;
@@ -476,6 +478,7 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
printf("in get_char_bitmap....\n");
#endif
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -505,6 +508,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
if(px == 0 && py == 0 && pwidth == 0 && pheight == 0)
return 1;
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -532,8 +536,9 @@ 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)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -543,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)
@@ -558,6 +566,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
int uni_char;
int x, y, width, height;
glyph_value = REAL_GLYPH(glyph_value);
if(devfont->charset_ops->conv_to_uc32)
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
@@ -577,7 +586,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/
static FONTOPS scripteasy_font_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
+12 -12
View File
@@ -102,10 +102,10 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
char type [LEN_FONT_NAME + 1];
char family [LEN_FONT_NAME + 1];
char style [LEN_FONT_NAME + 1];
char charset [LEN_FONT_NAME + 1];
char type [LEN_LOGFONT_NAME_FIELD + 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];
int height;
int j = 0, need = 0;
@@ -205,28 +205,28 @@ void mg_TermSysFont (void)
const char* GUIAPI GetSysCharset (BOOL wchar)
{
if (wchar) {
if (g_SysLogFont[1]->mbc_devfont)
return MBC_DEVFONT_INFO_P (g_SysLogFont[1])->charset_ops->name;
if (g_SysLogFont[1]->devfonts[1])
return g_SysLogFont[1]->devfonts[1]->charset_ops->name;
else
return NULL;
}
else
return SBC_DEVFONT_INFO_P (g_SysLogFont[0])->charset_ops->name;
return g_SysLogFont[0]->devfonts[0]->charset_ops->name;
}
int GUIAPI GetSysCharWidth (void)
{
DEVFONT* sbc_devfont = g_SysLogFont[0]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[0]->devfonts[0];
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[0], sbc_devfont);
}
int GUIAPI GetSysCCharWidth (void)
{
DEVFONT* mbc_devfont = g_SysLogFont[1]->mbc_devfont;
DEVFONT* mbc_devfont = g_SysLogFont[1]->devfonts[1];
if (mbc_devfont)
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
else
return GetSysCharWidth () * 2;
}
@@ -238,14 +238,14 @@ int GUIAPI GetSysCharHeight (void)
int GUIAPI GetSysFontMaxWidth (int font_id)
{
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
return sbc_devfont->font_ops->get_max_width (g_SysLogFont[font_id], sbc_devfont);
}
int GUIAPI GetSysFontAveWidth (int font_id)
{
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[font_id], sbc_devfont);
}
+1 -1
View File
@@ -86,7 +86,7 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
char file [MAX_PATH + 1];
sprintf (key, "name%d", i);
+1 -2
View File
@@ -6,8 +6,7 @@ u:arabic_test_unicode
hex:arabic_test_hex
MINIGUI_COMMON = /usr/local/include/minigui
LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lttf
#LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lfreetype
LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lfreetype
arabic_test:arabic_test.c $(MINIGUI_COMMON)
gcc arabic_test.c -Wall -g -o arabic_test $(LIBS)
+1 -1
View File
@@ -149,7 +149,7 @@ void read_total_file( void )
fclose (fp);
}
static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
static LRESULT HelloWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message) {
+2 -2
View File
@@ -101,10 +101,10 @@ static int test_correctness ()
if (index < 0) /* not a letter.*/
continue;
glyph_value = iso8859_6_char_glyph_value (NULL, 0, c, 1);
glyph_value = iso8859_6_get_char_value (NULL, 0, c, 1);
fprintf (stderr, "%x 's glyph value = %x\n", *c, glyph_value);
if (!test_glyph_value (index, glyph_value)) {
if (!iso8859_6_test_glyph_value (index, glyph_value)) {
fprintf (stderr, "Shape error: %x\n", *c);
return 0;
}
+3 -3
View File
@@ -6,13 +6,13 @@ helloworld:helloworld.c
gcc helloworld.c -Wall -g -o helloworld -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test:hebrew_test.c
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_release:hebrew_test.c
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_debug:hebrew_test.c
gcc hebrew_test.c -DARABIC_DEBUG -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -DARABIC_DEBUG -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_unicode:hebrew_test.c
gcc hebrew_test.c -DARABIC_UNICODE -DARABIC_DEBUG -g -o hebrew_test_u -lminigui_ths -lm -lfreetype -ljpeg -lz -lpng -lpthread
+13 -13
View File
@@ -59,23 +59,23 @@ char filename[256];
char fontname[50];
BOOL textout = TRUE;
RECT arabic_rc = {0, 0, 640, 480};
RECT hebrew_rc = {0, 0, 640, 480};
int line_num = 0;
static char msg_text [256] = "Show text with TextOut.";
static FILE *fp = NULL;
static PLOGFONT logfont_iso8859_8;
//static char arabic_text[] = {0xc7,0xe4,0xe1,0xd1,0xea,0xe2,0xa0,0xc7,0xe4,0xca,0xe2,0xe6,0xea,0x00};
//static char hebrew_text[] = {0xc7,0xe4,0xe1,0xd1,0xea,0xe2,0xa0,0xc7,0xe4,0xca,0xe2,0xe6,0xea,0x00};
static int reset_fp_pos()
{
arabic_rc.left = 0;
arabic_rc.top = 0;
arabic_rc.right = g_rcScr.right - 24;
arabic_rc.bottom = g_rcScr.bottom;
hebrew_rc.left = 0;
hebrew_rc.top = 0;
hebrew_rc.right = g_rcScr.right - 24;
hebrew_rc.bottom = g_rcScr.bottom;
if(!fp){
DBGLOG2("============================= arabic_test %s===============================\n", filename);
DBGLOG2("============================= hebrew_test %s===============================\n", filename);
fp = fopen(filename, "rb");
if (!fp) {
DBGLOG2("cannot open %s\n", filename);
@@ -140,7 +140,7 @@ void read_total_file( void )
fclose (fp);
}
static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
static LRESULT HelloWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message) {
@@ -196,13 +196,13 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
if(textout == TRUE) {
if(GetTextAlign(hdc) == TA_RIGHT)
TextOut(hdc, arabic_rc.right, i*line_height, pline);
TextOut(hdc, hebrew_rc.right, i*line_height, pline);
else
TextOut(hdc, arabic_rc.left, i*line_height, pline);
TextOut(hdc, hebrew_rc.left, i*line_height, pline);
}
else{
int height = DrawText(hdc, pline, -1, &arabic_rc, DT_RIGHT);
arabic_rc.top += height;
int height = DrawText(hdc, pline, -1, &hebrew_rc, DT_RIGHT);
hebrew_rc.top += height;
}
i++;
}
@@ -210,7 +210,7 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
/*
else{
read_total_file();
DrawText(hdc, filebuf, -1, &arabic_rc, DT_RIGHT);
DrawText(hdc, filebuf, -1, &hebrew_rc, DT_RIGHT);
}
*/
#endif
View File
View File
View File
View File
View File
+39 -39
View File
File diff suppressed because it is too large Load Diff
+293 -289
View File
File diff suppressed because it is too large Load Diff
+92
View File
@@ -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
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+110
View File
@@ -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
+197
View File
@@ -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 */
+109
View File
@@ -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
+65
View File
@@ -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
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
+57
View File
@@ -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 */
+84
View File
@@ -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 */
+196
View File
@@ -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
File diff suppressed because it is too large Load Diff
+164
View File
@@ -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
+94
View File
@@ -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 */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More