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 1ed5b44926 cleanup for 3.2.2 2019-01-15 15:13:50 +08:00
Vincent Wei 16287af2a6 fix the bug of wrong bbox handling for SUBPIXEL rendering of glyph 2019-01-15 14:53:57 +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 c975fe5b8d tune release notes 2019-01-13 16:23:57 +08:00
Vincent Wei b4569adbd5 skipp null pixels for subpixel glyph 2019-01-13 16:22:34 +08:00
Vincent Wei 4761333a1a skip null pixels for subpixel 2019-01-13 16:20:08 +08:00
Vincent Wei 715a44beeb typo for pitch 2019-01-13 14:32:49 +08:00
Vincent Wei e6bb4fa05f tune RELEASE NOTES 2019-01-13 14:24:14 +08:00
Vincent Wei c436af69bb fixbug: No need to make the pitch of FT2 monobitmap is single-byte aligned 2019-01-13 14:22:54 +08:00
290 changed files with 134968 additions and 29588 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
+98 -32
View File
@@ -10,6 +10,8 @@ Please report any bugs and incompatibilities in
### 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.
@@ -17,37 +19,42 @@ The styles of LOGFONT changed.
* Add new rendering style:
1. `FS_RENDER_ANY`: Not specified
1. `FS_RENDER_MONO`:
1. `FS_RENDER_OUTLINE`:
1. `FS_RENDER_GREY`:
1. `FS_RENDER_SUBPIXEL`:
* Remove some bad style definitions:
1. `FS_WEIGHT_BOOK`, use `FS_RENDER_GREY` instead.
1. `FS_WEIGHT_LIGHT`, use `FS_RENDER_OUTLINE` instead.
* Introduced the new weight styles:
* 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`:
1. `FONT_WEIGHT_EXTRA_LIGHT`:
1. `FONT_WEIGHT_LIGHT`:
1. `FONT_WEIGHT_REGULAR`:
1. `FONT_WEIGHT_MEDIUM`:
1. `FONT_WEIGHT_DEMIBOLD`:
1. `FONT_WEIGHT_BOLD`:
1. `FONT_WEIGHT_EXTRA_BOLD`:
1. `FONT_WEIGHT_BLACK`:
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`:
1. `FONT_DECORATE_NONE`:
1. `FONT_DECORATE_UNDERLINE`:
1. `FONT_DECORATE_STRUCKOUT`:
1. `FONT_DECORATE_BOTH`:
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 the back-compatibility, you can still use `CreateLogFont` to
create a new LOGFONT. However, the `FS_WEIGHT_BOOK` and `FS_WEIGHT_LIGHT`
will be ignored, and the rendering type will be set as `FS_RENDER_ANY`.
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 new app, you should use the new function `CreateLogFontEx` to
create a LOGFONT.
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
@@ -58,21 +65,75 @@ to
<weight><slant><flipping><other><decoration><rendering>
Obviously, `<underline>` and `<struckout>` are merged to `<decoration>`
Note that `<underline>` and `<struckout>` are merged to `<decoration>`
in order to keep the style string is still 6-character long.
Now, if you want to use the rendering style SUPIXEL for a TTF font,
please define the font name in the following way:
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
#### Changes of font rendering manners
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.
@@ -97,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.
@@ -116,6 +177,11 @@ Please report any bugs and incompatibilities in
* BUGFIXING:
1. handle `PNG_COLOR_TYPE_GRAY_ALPHA` color type of PNG files.
1. Fix a bug to free a null pointer (ReleaseDC).
1. No need to make the pitch of FT2 monobitmap is single-byte aligned.
This bug may generate dirty dots for monobitmap glyph from TTF.
1. Skip null pixels for SUBPIXEL glyphs. This bug will always show background
pixels of one SUBPIXEL glyph.
1. Fix the bug of wrong bounding box handling for SUBPIXEL rendering of glyph.
* TUNNING:
1. Tune GLYPHINFO structure and GetGlyphInfo to return BIDI glyph type.
@@ -126,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
+114 -93
View File
@@ -76,7 +76,8 @@ AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(time mktime localtime strdup strcasecmp strncasecmp strerror setlocale getpt)
AC_CHECK_FUNCS(time mktime localtime strdup strcasecmp strncasecmp strerror setlocale)
AC_CHECK_FUNCS(posix_memalign memalign valloc)
dnl ========================================================================
dnl User selectable options
@@ -164,7 +165,8 @@ build_incorefont_times="yes"
build_sef_support="no"
build_qpf_support="no"
use_ttf_lib="ft2"
build_ttf_support="yes"
build_complex_scripts="yes"
build_ttfcache_support="yes"
build_bmpf_support="yes"
@@ -193,6 +195,7 @@ build_eucjp_support="no"
build_shiftjis_support="no"
build_unicode_support="yes"
build_full_unicode="yes"
dnl Keyboard layout specific options
use_kbd_hebrewpc="no"
@@ -389,7 +392,7 @@ AC_ARG_ENABLE(netial,
build_net_ial_engine=$enableval)
AC_ARG_ENABLE(cisco_touchpad_ial,
[ --enable-cisco_touchpad_ial build the IAL engine for Cisco Touchpad <default=no>],
[ --enable-cisco_touchpad_ial build the IAL engine for Cisco Touchpad <default=no>],
build_cisco_touchpad_ial_engine=$enableval)
AC_ARG_ENABLE(mstar_ial,
@@ -536,14 +539,18 @@ AC_ARG_ENABLE(sefsupport,
[ --enable-sefsupport build support for koxomo scripteasy (SEF) <default=no>],
build_sef_support=$enableval)
AC_ARG_WITH(ttfsupport,
[ --with-ttfsupport=ft2/none How to support TrueType font (FreeType 2 or None) <default=ft2>],
use_ttf_lib=$withval)
AC_ARG_ENABLE(ttfsupport,
[ --enable-ttfsupport build support for TrueType/OpenType (needs FreeType2 library) <default=yes>],
build_ttf_support=$enableval)
AC_ARG_ENABLE(ttfcache,
[ --enable-ttfcache include ttf cache support <default=no>],
[ --enable-ttfcache build ttf cache support <default=no>],
build_ttfcache_support=$enableval)
AC_ARG_ENABLE(complexscripts,
[ --enable-complexscripts build support for complex scripts (needs HarzBuff library) <default=yes>],
build_complex_scripts=$enableval)
AC_ARG_ENABLE(bmpfsupport,
[ --enable-bmpfsupport build support for Bitmap Font (bmpf) <default=yes>],
build_bmpf_support=$enableval)
@@ -636,6 +643,10 @@ AC_ARG_ENABLE(unicodesupport,
[ --enable-unicodesupport include UNICODE (ISO-10646-1 and UTF-8 encoding) support <default=yes>],
build_unicode_support=$enableval)
AC_ARG_ENABLE(fullunicode,
[ --enable-fullunicode include support for full UNICODE code points <default=yes>],
build_full_unicode=$enableval)
AC_ARG_ENABLE(kbdhebrewpc,
[ --enable-kbdhebrewpc include keyboard layout for Hebrew PC keyboard <default=no>],
use_kbd_hebrewpc=$enableval)
@@ -834,7 +845,7 @@ CheckFBCON()
AC_ARG_ENABLE(videofbcon,
[ --enable-videofbcon include FrameBuffer console NEWGAL engine <default=yes>],
enable_video_fbcon=$enableval)
if test x$enable_video_fbcon = xyes; then
if test "x$enable_video_fbcon" = "xyes"; then
AC_MSG_CHECKING(for FrameBuffer console support)
video_fbcon=no
AC_TRY_COMPILE([
@@ -846,7 +857,7 @@ CheckFBCON()
video_fbcon=yes
])
AC_MSG_RESULT($video_fbcon)
if test x$video_fbcon = xyes; then
if test "x$video_fbcon" = "xyes"; then
AC_DEFINE(_MGGAL_FBCON, 1,
[Define if include FrameBuffer console NEWGAL engine])
VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon"
@@ -856,7 +867,7 @@ CheckFBCON()
AC_CHECK_LIB(pciaccess, pci_system_init,
DEP_LIBS="$DEP_LIBS -lpciaccess", have_pciaccess="no")
if test x$have_pciaccess = xyes; then
if test "x$have_pciaccess" = "xyes"; then
AC_DEFINE(_MGHAVE_PCIACCESS, 1,
[Define if PCIAccess lib is available])
LDFLAGS="$LDFLAGS -lpciaccess"
@@ -892,21 +903,21 @@ CheckXVFB()
[ --enable-videortosxvfb include RTOS Virtual FrameBuffer NEWGAL engine <default=no>. Please disable pcxvfb to enable rtosxvfb],
enable_video_rtos_xvfb=$enableval)
if test "x$enable_video_pc_xvfb" = "xyes"; then
dnl CheckPCXVFB
if test "x$enable_video_pc_xvfb" = "xyes"; then
dnl CheckPCXVFB
AC_DEFINE(_MGGAL_PCXVFB, 1,
[Define if include PC Virtual FrameBuffer NEWGAL engine])
VIDEO_SUBDIRS="$VIDEO_SUBDIRS pcxvfb"
VIDEO_DRIVERS="$VIDEO_DRIVERS pcxvfb/libvideo_pcxvfb.la"
else
if test "x$enable_video_rtos_xvfb" = "xyes"; then
dnl CheckRTOSXVFB
else
if test "x$enable_video_rtos_xvfb" = "xyes"; then
dnl CheckRTOSXVFB
AC_DEFINE(_MGGAL_RTOSXVFB, 1,
[Define if include RTOS Virtual FrameBuffer NEWGAL engine])
VIDEO_SUBDIRS="$VIDEO_SUBDIRS rtos_xvfb"
VIDEO_DRIVERS="$VIDEO_DRIVERS rtos_xvfb/libvideo_rtos_xvfb.la"
fi
fi
fi
fi
}
@@ -1099,7 +1110,7 @@ CheckDirectFBVideo()
[ --enable-videodfb include NEWGAL engine for DirectFB <default=no>],
enable_video_dfb=$enableval)
if test x$enable_video_dfb = xyes; then
if test "x$enable_video_dfb" = "xyes"; then
AC_MSG_CHECKING(for DirectFB support)
video_dfb=no
AC_TRY_COMPILE([
@@ -1109,7 +1120,7 @@ CheckDirectFBVideo()
video_dfb=yes
])
AC_MSG_RESULT($video_dfb)
if test x$video_dfb = xyes; then
if test "x$video_dfb" = "xyes"; then
AC_DEFINE(_MGGAL_DFB, 1,
[Define if include NEWGAL engine for DirectFB])
VIDEO_SUBDIRS="$VIDEO_SUBDIRS dfb"
@@ -1121,7 +1132,7 @@ CheckDirectFBVideo()
[ --enable-videost7167 include NEWGAL engine for ST7167 on DirectFB <default=no>],
enable_video_dfb_st7167=$enableval)
if test x$enable_video_dfb_st7167 = xyes; then
if test "x$enable_video_dfb_st7167" = "xyes"; then
AC_DEFINE(_MGGAL_DFB_ST7167, 1,
[Define if include ST7167 subdriver for NEWGAL engine of DirectFB])
fi
@@ -1515,11 +1526,11 @@ AC_ARG_WITH(targetname,
case "$with_targetname" in
fmsoft)
AC_DEFINE(__TARGET_FMSOFT__, 1,
[Define for FMSoft internal use])
[Define for FMSoft internal use])
;;
mstudio)
AC_DEFINE(__TARGET_MSTUDIO__, 1,
[Define for FMSoft miniStudio])
[Define for FMSoft miniStudio])
;;
stb810)
AC_DEFINE(__TARGET_STB810__, 1,
@@ -1547,11 +1558,11 @@ case "$with_targetname" in
;;
bfin)
AC_DEFINE(__TARGET_BLACKFIN__, 1,
[Define for Blackfin run uClinux])
[Define for Blackfin run uClinux])
;;
c33l05)
AC_DEFINE(__TARGET_C33L05__, 1,
[Define for EPSON C33L05 (axLinux)])
[Define for EPSON C33L05 (axLinux)])
;;
S3C6410)
CFLAGS="$CFLAGS -D_WITH_TARGET_S3C6410"
@@ -1977,33 +1988,29 @@ if test "x$build_upf_support" = "xyes"; then
fi
dnl Check FreeType lib
case "$use_ttf_lib" in
ft2)
dnl Check for FreeType2 library
if test "x$build_ttf_support" = "xyes"; then
dnl Check for FreeType2 library
AC_CHECK_LIB(freetype, FT_Library_Version,
DEP_LIBS="$DEP_LIBS -lfreetype",
use_ttf_lib="none")
;;
ft1)
dnl Check for FreeType1 library
AC_CHECK_LIB(ttf, TT_FreeType_Version,
DEP_LIBS="$DEP_LIBS -lttf",
use_ttf_lib="none")
;;
*)
use_ttf_lib="none"
;;
esac
build_ttf_support="no")
fi
dnl Dealing with TTF cache size
case "$use_ttf_lib" in
ft1|ft2)
if test "x$build_ttf_support" = "xyes"; then
if test "x$build_complex_scripts" = "xyes"; then
dnl Check for HarfBuzz library
AC_CHECK_LIB(harfbuzz, hb_version,
DEP_LIBS="$DEP_LIBS -lharfbuzzex",
build_complex_scripts="no")
fi
if test "x$build_ttfcache_support" = "xyes"; then
AC_DEFINE(_MGFONT_TTF_CACHE, 1,
[Define if include ttf cache])
AC_ARG_WITH(ttfcachesize,
[ --with-ttfcachesize=[64/128/256/512/1024]])
[ --with-ttfcachesize=[64/128/256/512/1024/2048]])
case "$with_ttfcachesize" in
64)
@@ -2026,79 +2033,85 @@ case "$use_ttf_lib" in
AC_DEFINE(_MGTTF_CACHE_SIZE, 1024,
[Define if compile max ttf cahce size for 1024k])
;;
2048)
AC_DEFINE(_MGTTF_CACHE_SIZE, 2048,
[Define if compile max ttf cahce size for 2048k])
;;
*)
AC_DEFINE(_MGTTF_CACHE_SIZE, 256,
[Define if compile max ttf cahce size for 256k])
AC_DEFINE(_MGTTF_CACHE_SIZE, 1024,
[Define if compile max ttf cahce size for 1024k (default value)])
;;
esac
AC_ARG_WITH(ttfcachenum,
[ --with-mttfcachenum=[10/20/40]])
case "$with_mttfcachenum" in
10)
AC_DEFINE(_MGMAX_TTF_CACHE, 10,
[Define if compile max ttf cahce number for 10])
[ --with-ttfcachenum=[16/32/64/128]])
case "$with_ttfcachenum" in
16)
AC_DEFINE(_MGMAX_TTF_CACHE, 16,
[Define if compile max ttf cahce number for 16])
;;
20)
AC_DEFINE(_MGMAX_TTF_CACHE, 20,
[Define if compile max ttf cahce number for 20])
32)
AC_DEFINE(_MGMAX_TTF_CACHE, 32,
[Define if compile max ttf cahce number for 32])
;;
40)
AC_DEFINE(_MGMAX_TTF_CACHE, 40,
[Define if compile max ttf cahce number for 40])
64)
AC_DEFINE(_MGMAX_TTF_CACHE, 64,
[Define if compile max ttf cahce number for 64])
;;
128)
AC_DEFINE(_MGMAX_TTF_CACHE, 128,
[Define if compile max ttf cahce number for 128])
;;
*)
AC_DEFINE(_MGMAX_TTF_CACHE, 10,
[Define if compile max ttf cahce number for 10 (default value)])
AC_DEFINE(_MGMAX_TTF_CACHE, 32,
[Define if compile max ttf cahce number for 32 (default value)])
;;
esac
fi
;;
esac
fi
dnl Dealing with CFLAGS and LDFLAGS
case "$use_ttf_lib" in
ft1)
build_unicode_support="yes"
if test "x$build_complex_scripts" = "xyes"; then
build_ttf_support="yes"
AC_DEFINE(_MGCOMPLEX_SCRIPTS, 1,
[Define if support complex scripts based on HarfBuzz])
AC_DEFINE(_MGFONT_TTF, 1,
[Define if support TrueType font])
AC_ARG_WITH(hb_includes,
[ --with-hb-includes=DIR where the HarfBuzz includes are])
AC_ARG_WITH(ft1_includes,
[ --with-ft1-includes=DIR where the FreeType1 includes are])
if test "x$with_hb_includes" = "x"; then
HB_INC_DIR="-I/usr/local/include/harfbuzz"
else
HB_INC_DIR="-I$with_hb_includes"
fi
if test "x$with_ft1_includes" = "x"; then
FT1_INC_DIR="-I/usr/include/freetype1"
else
FT1_INC_DIR="-I$with_ft1_includes"
fi
AC_SUBST(HB_INC_DIR)
fi
AC_SUBST(FT1_INC_DIR)
;;
ft2)
build_unicode_support="yes"
AC_DEFINE(_MGFONT_FT2, 1,
[Define if support TrueType font based on FreeType2])
if test "x$build_ttf_support" = "xyes"; then
build_unicode_support="yes"
AC_DEFINE(_MGFONT_FT2, 1,
[Define if support TrueType/OpenType fonts based on FreeType2])
AC_ARG_WITH(ft2_includes,
[ --with-ft2-includes=DIR where the FreeType2 includes are])
with_ft2_includes=""
AC_ARG_WITH(ft2_includes,
[ --with-ft2-includes=DIR where the FreeType2 includes are],
with_ft2_includes=$withval)
if test "x$with_ft2_includes" = "x"; then
FT2_INC_DIR="-I/usr/include/freetype2"
else
FT2_INC_DIR="-I$with_ft2_includes"
fi
if test "x$with_ft2_includes" = "x"; then
FT2_INC_DIR="-I/usr/include/freetype2"
else
FT2_INC_DIR="-I$with_ft2_includes"
fi
AC_SUBST(FT2_INC_DIR)
;;
esac
AC_SUBST(FT2_INC_DIR)
fi
if test "x$build_bmpf_support" = "xyes"; then
AC_DEFINE(_MGFONT_BMPF, 1,
[Define if support Bitmap fonts])
fi
if test "x$build_latin2_support" = "xyes"; then
AC_DEFINE(_MGCHARSET_LATIN2, 1,
[Define if support Latin 2 charset])
@@ -2209,6 +2222,11 @@ if test "x$build_unicode_support" = "xyes"; then
[Define if support UNICODE])
fi
if test "x$build_full_unicode" = "xyes"; then
AC_DEFINE(_MGCHARSET_UNICODE_FULL, 1,
[Define if support full UNICODE code points])
fi
if test "x$use_kbd_hebrewpc" = "xyes"; then
AC_DEFINE(_MGKBDLAYOUT_HEBREWPC, 1,
[Define if use the Hebrew PC keyboard layout])
@@ -2433,8 +2451,8 @@ fi
if test "x$build_ctrl_textedit_new" = "xyes"; then
AC_DEFINE(_MGCTRL_TEXTEDIT, 1,
[Define if include TEXTEDIT control])
AC_DEFINE(_MGCTRL_TEXTEDIT_USE_NEW_IMPL, 1,
[Define if use new implementation of TEXTEDIT control])
AC_DEFINE(_MGCTRL_TEXTEDIT_USE_NEW_IMPL, 1,
[Define if use new implementation of TEXTEDIT control])
fi
if test "x$build_splash" = "xyes"; then
@@ -2462,20 +2480,23 @@ dnl define _GNU_SOURCE for pthread_rwlock_t
CFLAGS="$CFLAGS -D_GNU_SOURCE"
if test "x$devel_mode" = "xyes"; then
CPPFLAGS="$CPPFLAGS -D_DEBUG"
CPPFLAGS="$CPPFLAGS -DDEBUG"
if test "x$detail_debug" = "xyes"; then
CPPFLAGS="$CPPFLAGS -DDEBUG"
CPPFLAGS="$CPPFLAGS -D_DEBUG"
fi
if test "$ac_cv_prog_gcc" = "yes"; then
CPPFLAGS="$CPPFLAGS -Wall -Werror"
fi
AC_DEFINE(_MGDEVEL_MODE, 1,
[Define if developer mode enabled])
else
CPPFLAGS="$CPPFLAGS -DNDEBUG"
fi
if test "$ac_cv_prog_gcc" = "yes"; then
CFLAGS="$CFLAGS -O2 -Wstrict-prototypes -pipe"
CFLAGS="$CFLAGS -O2 -fmax-errors=10 -Wstrict-prototypes -pipe"
fi
if test "x$runtime_mode" = "xths"; then
+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;
+89 -36
View File
@@ -169,10 +169,10 @@ typedef signed int Sint32;
/* Figure out how to support 64-bit datatypes */
#if !defined(__STRICT_ANSI__)
# if defined(__GNUC__)
# define MGUI_HAS_64BIT_TYPE long long
# define MGUI_HAS_64BIT_TYPE long long
# endif
# if defined(__CC_ARM)
# define MGUI_HAS_64BIT_TYPE long long
# define MGUI_HAS_64BIT_TYPE long long
# endif
# if defined(_MSC_VER)
# define MGUI_HAS_64BIT_TYPE __int64
@@ -199,8 +199,8 @@ typedef signed MGUI_HAS_64BIT_TYPE Sint64;
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef struct {
Uint32 hi;
Uint32 lo;
Uint32 hi;
Uint32 lo;
} Uint64, Sint64;
#endif
@@ -221,6 +221,38 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/** @} end of basic_types */
/* Here we provide MG_GNUC_EXTENSION as an alias for __extension__,
* where this is valid. This allows for warningless compilation of
* "long long" types even in the presence of '-ansi -pedantic'.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
#define MG_GNUC_EXTENSION __extension__
#else
#define MG_GNUC_EXTENSION
#endif
/*
* The MG_LIKELY and MG_UNLIKELY macros let the programmer give hints to
* the compiler about the expected result of an expression. Some compilers
* can use this information for optimizations.
*/
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define _MG_BOOLEAN_EXPR(expr) \
MG_GNUC_EXTENSION ({ \
int _g_boolean_var_; \
if (expr) \
_g_boolean_var_ = 1; \
else \
_g_boolean_var_ = 0; \
_g_boolean_var_; \
})
#define MG_LIKELY(expr) (__builtin_expect (_MG_BOOLEAN_EXPR(expr), 1))
#define MG_UNLIKELY(expr) (__builtin_expect (_MG_BOOLEAN_EXPR(expr), 0))
#else
#define MG_LIKELY(expr) (expr)
#define MG_UNLIKELY(expr) (expr)
#endif
/**
* \defgroup endian_info Endianness information
* @{
@@ -694,6 +726,20 @@ typedef UINT_PTR LPARAM;
*/
#define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
/**
* \def MAKEWORD32(first, second, third, fourth)
* \brief Makes a WORD32 value with four bytes.
*
* \sa MAKEWORD16, FIRSTBYTE, SECONDBYTE, THIRDBYTE, FOURTHBYTE
*/
#define MAKEDWORD32(first, second, third, fourth) \
((DWORD32)( \
((BYTE)(first)) | \
(((DWORD32)((BYTE)(second))) << 8) | \
(((DWORD32)((BYTE)(third))) << 16) | \
(((DWORD32)((BYTE)(fourth))) << 24) \
))
/**
* \def MAKEWPARAM(first, second, third, fourth)
* \brief Makes a WPARAM value with four bytes.
@@ -832,25 +878,28 @@ typedef DWORD32 RGBCOLOR;
* \brief Makes a RGBA triple value from red \a r, green \a g,
* blue \a b and alpha \a components.
*
* \note The red, green, blue and alpha components are all ranged from 0 to 255,
* and the returned value will be a double word.
* \note The red, green, blue, and alpha components are all ranged
* from 0 to 255, and the returned value will be a 32-bit double word.
*
* \sa GetRValue, GetGValue, GetBValue, GetAValue
*/
#define MakeRGBA(r, g, b, a) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
| ((DWORD32)((BYTE)(b)) << 16) | ((DWORD32)((BYTE)(a)) << 24))
#define MakeRGBA(r, g, b, a) \
(((DWORD32)((BYTE)(r))) \
| ((DWORD32)((BYTE)(g)) << 8) \
| ((DWORD32)((BYTE)(b)) << 16) \
| ((DWORD32)((BYTE)(a)) << 24))
/**
* \def MakeRGB(r, g, b)
* \brief Makes a RGB triple value from red \a r, green \a g, and blue \a b components.
* \brief Makes a RGB triple value from red \a r, green \a g,
* and blue \a b components.
*
* \note The red, green, and blue components are all ranged from 0 to 255,
* and the returned value will be a double word.
* and the returned value will be a 32-bit double word.
*
* \sa GetRValue, GetGValue, GetBValue
* \sa GetRValue, GetGValue, GetBValue, GetAValue
*/
#define MakeRGB(r, g, b) (((DWORD32)((BYTE)(r))) | ((DWORD32)((BYTE)(g)) << 8) \
| ((DWORD32)((BYTE)(b)) << 16))
#define MakeRGB(r, g, b) MakeRGBA((r), (g), (b), 255)
/**
* A rectangle defined by coordinates of corners.
@@ -861,8 +910,7 @@ typedef DWORD32 RGBCOLOR;
*
* \sa PRECT, GAL_Rect
*/
typedef struct _RECT
{
typedef struct _RECT {
/**
* The x coordinate of the upper-left corner of the rectangle.
*/
@@ -1762,12 +1810,12 @@ struct tm {
#include "os_type.h"
#include "os_file_api.h"
#define fopen tp_fopen
#define fclose tp_fclose
#define fwrite tp_fwrite
#define fread tp_fread
#define fseek tp_fseek
#define feof tp_feof
#define fopen tp_fopen
#define fclose tp_fclose
#define fwrite tp_fwrite
#define fread tp_fread
#define fseek tp_fseek
#define feof tp_feof
#undef assert
#define _HAVE_ASSERT 1
@@ -1891,8 +1939,8 @@ int init_minigui_printf (int (*output_char) (int ch),
#ifdef WIN32
# include <float.h>
# define isnan _isnan
# define finite _finite
# define isnan _isnan
# define finite _finite
#endif
#undef _I18N_MB_REQUIRED
@@ -2041,6 +2089,22 @@ int init_minigui_printf (int (*output_char) (int ch),
#define TCS_CLRLINE(fp)
#endif
#define _MG_PRINTF(fmt, ...) \
do { \
TCS_GREEN (stdout); \
fprintf (stdout, fmt, ##__VA_ARGS__); \
TCS_NONE (stdout); \
} while (0)
#define _WRN_PRINTF(fmt, ...) \
do { \
TCS_BROWN (stderr); \
fprintf (stderr, "%s: ", __FUNCTION__); \
fprintf (stderr, fmt, ##__VA_ARGS__); \
fprintf (stderr, "\n"); \
TCS_NONE (stderr); \
} while (0)
#define _ERR_PRINTF(fmt, ...) \
do { \
TCS_RED (stderr); \
@@ -2048,25 +2112,14 @@ int init_minigui_printf (int (*output_char) (int ch),
TCS_NONE (stderr); \
} while (0)
#ifdef _DEBUG
# define _MG_PRINTF(fmt, ...) \
do { \
TCS_GREEN (stdout); \
fprintf (stdout, fmt, ##__VA_ARGS__); \
TCS_NONE (stdout); \
} while (0)
# ifdef DEBUG
# define _DBG_PRINTF(fmt, ...) \
#if defined(_DEBUG)
# define _DBG_PRINTF(fmt, ...) \
do { \
TCS_YELLOW (stderr); \
fprintf (stderr, fmt, ##__VA_ARGS__); \
TCS_NONE (stderr); \
} while (0)
# else
# define _DBG_PRINTF(fmt, ...)
# endif
#else
# define _MG_PRINTF(fmt, ...)
# define _DBG_PRINTF(fmt, ...)
#endif
+21 -21
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 */
+4590 -793
View File
File diff suppressed because it is too large Load Diff
+321
View File
@@ -3508,6 +3508,327 @@ MG_EXPORT char * strtrimall (char* src);
/** @} end of str_helpers */
/**
* \defgroup slices_allocator_fns Slice Memory Allocator
*
* An efficient way to allocate groups of equal-sized chunks of memory.
*
* Memory slices provide a space-efficient and multi-processing scalable
* way to allocate equal-sized pieces of memory, just like the
* MiniGUI's block data heap (\a block_heap_fns). Relative to the
* standard malloc function and block data heap, this allocator can
* avoid excessive memory-waste, scalability and performance problems.
*
* Note that this implementation is derived from LGPL'd glib.
*
* To achieve these goals, the slice allocator uses a sophisticated,
* layered design that has been inspired by Bonwick's slab allocator
* ([Bonwick94](http://citeseer.ist.psu.edu/bonwick94slab.html)
* Jeff Bonwick, The slab allocator: An object-caching kernel
* memory allocator. USENIX 1994, and
* [Bonwick01](http://citeseer.ist.psu.edu/bonwick01magazines.html)
* Bonwick and Jonathan Adams, Magazines and vmem: Extending the
* slab allocator to many cpu's and arbitrary resources. USENIX 2001)
*
* It uses posix_memalign() to optimize allocations of many equally-sized
* chunks, and has per-thread free lists (the so-called magazine layer)
* to quickly satisfy allocation requests of already known structure sizes.
* This is accompanied by extra caching logic to keep freed memory around
* for some time before returning it to the system. Memory that is unused
* due to alignment constraints is used for cache colorization (random
* distribution of chunk addresses) to improve CPU cache utilization. The
* caching layer of the slice allocator adapts itself to high lock
* contention to improve scalability.
*
* The slice allocator can allocate blocks as small as two pointers, and
* unlike malloc(), it does not reserve extra space per block. For large
* block sizes, mg_slice_new() and mg_slice_alloc() will automatically
* delegate to the system malloc() implementation. For newly written code
* it is recommended to use the new `mg_slice` API instead of malloc() and
* friends, as long as objects are not resized during their lifetime and
* the object size used at allocation time is still available when freeing.
*
* Here is an example for using the slice allocator:
*
* \code
* char *mem[10000];
* int i;
*
* // Allocate 10000 blocks.
* for (i = 0; i < 10000; i++)
* {
* mem[i] = mg_slice_alloc (50);
*
* // Fill in the memory with some junk.
* for (j = 0; j < 50; j++)
* mem[i][j] = i * j;
* }
*
* // Now free all of the blocks.
* for (i = 0; i < 10000; i++)
* mg_slice_free (50, mem[i]);
* \endcode
*
* And here is an example for using the slice allocator
* with data structures:
*
* \code
* MyStruct *array;
*
* // Allocate one block, using the mg_slice_new() macro.
* array = mg_slice_new (MyStruct);
*
* // We can now use array just like a normal pointer to a structure.
* array->data = NULL;
* array->len = 0;
* array->alloc = 0;
* array->zero_terminated = (zero_terminated ? 1 : 0);
* array->clear = (clear ? 1 : 0);
* array->elt_size = elt_size;
*
* // We can free the block, so it can be reused.
* mg_slice_delete (MyStruct, array);
* \endcode
*
* @{
*/
/**
* mg_slice_alloc:
* @block_size: the number of bytes to allocate
*
* Allocates a block of memory from the slice allocator.
* The block address handed out can be expected to be aligned
* to at least 1 * sizeof (void*),
* though in general slices are 2 * sizeof (void*) bytes aligned,
* if a malloc() fallback implementation is used instead,
* the alignment may be reduced in a libc dependent fashion.
* Note that the underlying slice allocation mechanism can
* be changed with the [`MG_SLICE=always-malloc`][MG_SLICE]
* environment variable.
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0
*
* Since: 3.4.0
*/
MG_EXPORT void *mg_slice_alloc(size_t block_size);
/**
* mg_slice_alloc0:
* @block_size: the number of bytes to allocate
*
* Allocates a block of memory via mg_slice_alloc() and initializes
* the returned memory to 0. Note that the underlying slice allocation
* mechanism can be changed with the [`MG_SLICE=always-malloc`][MG_SLICE]
* environment variable.
*
* Returns: a pointer to the allocated block, which will be %NULL if and only
* if @mem_size is 0
*
* Since: 3.4.0
*/
MG_EXPORT void *mg_slice_alloc0(size_t block_size);
/**
* mg_slice_copy:
* @block_size: the number of bytes to allocate
* @mem_block: the memory to copy
*
* Allocates a block of memory from the slice allocator
* and copies @block_size bytes into it from @mem_block.
*
* @mem_block must be non-%NULL if @block_size is non-zero.
*
* Returns: a pointer to the allocated memory block, which will be %NULL if and
* only if @mem_size is 0
*
* Since: 3.4.0
*/
MG_EXPORT void *mg_slice_copy(size_t block_size, const void *mem_block);
/**
* mg_slice_free:
* @block_size: the size of the block
* @mem_block: a pointer to the block to free
*
* Frees a block of memory.
*
* The memory must have been allocated via mg_slice_alloc() or
* mg_slice_alloc0() and the @block_size has to match the size
* specified upon allocation. Note that the exact release behaviour
* can be changed with the [`MG_DEBUG=gc-friendly`][MG_DEBUG] environment
* variable, also see [`MG_SLICE`][MG_SLICE] for related debugging options.
*
* If @mem_block is %NULL, this function does nothing.
*
* Since: 3.4.0
*/
MG_EXPORT void mg_slice_free(size_t block_size, void *mem_block);
/**
* mg_slice_free_chain_with_offset:
* @block_size: the size of the blocks
* @mem_chain: a pointer to the first block of the chain
* @next_offset: the offset of the @next field in the blocks
*
* Frees a linked list of memory blocks of structure type @type.
*
* The memory blocks must be equal-sized, allocated via
* mg_slice_alloc() or mg_slice_alloc0() and linked together by a
* @next pointer (similar to #GSList). The offset of the @next
* field in each block is passed as third argument.
* Note that the exact release behaviour can be changed with the
* [`MG_DEBUG=gc-friendly`][MG_DEBUG] environment variable, also see
* [`MG_SLICE`][MG_SLICE] for related debugging options.
*
* If @mem_chain is %NULL, this function does nothing.
*
* Since: 3.4.0
*/
MG_EXPORT void mg_slice_free_chain_with_offset(size_t block_size,
void *mem_chain, size_t next_offset);
/**
* mg_slice_new:
* @type: the type to allocate, typically a structure name
*
* A convenience macro to allocate a block of memory from the
* slice allocator.
*
* It calls mg_slice_alloc() with `sizeof (@type)` and casts the
* returned pointer to a pointer of the given type, avoiding a type
* cast in the source code. Note that the underlying slice allocation
* mechanism can be changed with the [`MG_SLICE=always-malloc`][MG_SLICE]
* environment variable.
*
* This can never return %NULL as the minimum allocation size from
* `sizeof (@type)` is 1 byte.
*
* Returns: (not nullable): a pointer to the allocated block, cast to a pointer
* to @type
*
* Since: 3.4.0
*/
#define mg_slice_new(type) ((type*)mg_slice_alloc(sizeof (type)))
/**
* mg_slice_new0:
* @type: the type to allocate, typically a structure name
*
* A convenience macro to allocate a block of memory from the
* slice allocator and set the memory to 0.
*
* It calls mg_slice_alloc0() with `sizeof (@type)`
* and casts the returned pointer to a pointer of the given type,
* avoiding a type cast in the source code.
* Note that the underlying slice allocation mechanism can
* be changed with the [`MG_SLICE=always-malloc`][MG_SLICE]
* environment variable.
*
* This can never return %NULL as the minimum allocation size from
* `sizeof (@type)` is 1 byte.
*
* Returns: (not nullable): a pointer to the allocated block, cast to a pointer
* to @type
*
* Since: 3.4.0
*/
#define mg_slice_new0(type) ((type*)mg_slice_alloc0(sizeof (type)))
/* MemoryBlockType *
* mg_slice_dup (MemoryBlockType,
* MemoryBlockType *mem_block);
* mg_slice_delete (MemoryBlockType,
* MemoryBlockType *mem_block);
* mg_slice_delete_chain (MemoryBlockType,
* MemoryBlockType *first_chain_block,
* memory_block_next_field);
* pseudo prototypes for the macro definitions following below.
*/
/**
* mg_slice_dup:
* @type: the type to duplicate, typically a structure name
* @mem: (not nullable): the memory to copy into the allocated block
*
* A convenience macro to duplicate a block of memory using
* the slice allocator.
*
* It calls mg_slice_copy() with `sizeof (@type)`
* and casts the returned pointer to a pointer of the given type,
* avoiding a type cast in the source code.
* Note that the underlying slice allocation mechanism can
* be changed with the [`MG_SLICE=always-malloc`][MG_SLICE]
* environment variable.
*
* This can never return %NULL.
*
* Returns: (not nullable): a pointer to the allocated block, cast to a pointer
* to @type
*
* Since: 3.4.0
*/
#define mg_slice_dup(type, mem) \
(1 ? (type*) mg_slice_copy (sizeof (type), (mem)) \
: ((void) ((type*) 0 == (mem)), (type*) 0))
/**
* mg_slice_delete:
* @type: the type of the block to free, typically a structure name
* @mem: a pointer to the block to free
*
* A convenience macro to free a block of memory that has
* been allocated from the slice allocator.
*
* It calls mg_slice_free() using `sizeof (type)`
* as the block size.
* Note that the exact release behaviour can be changed with the
* [`MG_DEBUG=gc-friendly`][MG_DEBUG] environment variable, also see
* [`MG_SLICE`][MG_SLICE] for related debugging options.
*
* If @mem is %NULL, this macro does nothing.
*
* Since: 3.4.0
*/
#define mg_slice_delete(type, mem) \
do { \
if (1) mg_slice_free (sizeof (type), (mem)); \
else (void) ((type*) 0 == (mem)); \
} while(0)
/**
* mg_slice_delete_chain:
* @type: the type of the @mem_chain blocks
* @mem_chain: a pointer to the first block of the chain
* @next: the field name of the next pointer in @type
*
* Frees a linked list of memory blocks of structure type @type.
* The memory blocks must be equal-sized, allocated via
* mg_slice_alloc() or mg_slice_alloc0() and linked together by
* a @next pointer (similar to #GSList). The name of the
* @next field in @type is passed as third argument.
* Note that the exact release behaviour can be changed with the
* [`MG_DEBUG=gc-friendly`][MG_DEBUG] environment variable, also see
* [`MG_SLICE`][MG_SLICE] for related debugging options.
*
* If @mem_chain is %NULL, this function does nothing.
*
* Since: 3.4.0
*/
#define mg_slice_delete_chain(type, mem_chain, next) \
do { \
if (1) mg_slice_free_chain_with_offset (sizeof (type), \
(mem_chain), G_STRUCT_OFFSET (type, next)); \
else (void) ((type*) 0 == (mem_chain)); \
} while(0)
#ifdef _MGDEVEL_MODE
MG_EXPORT void mg_slice_debug_tree_statistics(void);
#endif
/** @} end of slices_allocator_fns */
/** @} end of global_fns */
/** @} end of fns */
+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
@@ -172,15 +172,14 @@ static int init_sbdata (HWND hwnd, PSCROLLBARDATA pdata, RECT * scRect)
{
DWORD win_style = GetWindowStyle (hwnd);
if (!GetWindowRect (hwnd, scRect))
{
_MG_PRINTF ("ScrollBar Rect error!\n");
if (!GetWindowRect (hwnd, scRect)) {
_WRN_PRINTF ("ScrollBar Rect error!");
return -1;
}
if ((win_style & SBS_NOSHAFT) && (win_style & SBS_NOARROW))
{
_MG_PRINTF ("ScrollBar styles error!\n");
_WRN_PRINTF ("ScrollBar styles error!");
return -1;
}
if (!(win_style & SBS_HORZ))
@@ -285,7 +284,7 @@ int track_thumb (HWND hwnd, PSCROLLBARDATA data, int x, int y)
if (!data)
{
_MG_PRINTF ("addtional data2 is NULL\n");
_WRN_PRINTF ("addtional data2 is NULL");
return -1;
}
@@ -364,7 +363,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
/* create the main data construction for the control */
if (!(data = (PSCROLLBARDATA) malloc (sizeof (SCROLLBARDATA))))
{
_MG_PRINTF ("Create ScrollBar control failure!\n");
_WRN_PRINTF ("Create ScrollBar control failure!");
return -1;
}
memset (data, 0 , sizeof (SCROLLBARDATA));
@@ -373,7 +372,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if(0 != init_sbdata(hwnd, data, &rc))
{
free(data);
_MG_PRINTF ("Create ScrollBar control failure!\n");
_WRN_PRINTF ("Create ScrollBar control failure!");
return -1;
}
@@ -388,7 +387,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case MSG_DESTROY:
{
/* release the scrollbar data construction */
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
free(data);
/** destry caret */
DestroyCaret (hwnd);
@@ -400,11 +399,11 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
RECT * rc_expect;
DWORD win_style;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if (!data)
{
_MG_PRINTF ("addition data2 is NULL \n");
_WRN_PRINTF ("addition data2 is NULL");
return 1;
}
@@ -449,7 +448,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case MSG_CSIZECHANGED:
{
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
pCtrl = (PCONTROL)hwnd;
pCtrl->left = pCtrl->cl;
pCtrl->top = pCtrl->ct;
@@ -467,7 +466,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
int y_pos = HISWORD (lParam);
const WINDOWINFO* winfo = NULL;
HDC hdc;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
winfo = GetWindowInfo(hwnd);
hdc = GetClientDC (hwnd);
@@ -590,7 +589,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case MSG_MOUSEMOVEIN:
{
BOOL in_out = (BOOL)wParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if (!in_out)
{
DPRINTF ("<<<<<<<<<<<<MOVEOUT<<<<<<<<<<<<<\n");
@@ -630,7 +629,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
}
winfo = GetWindowInfo(hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
mouse_pos = get_mouse_pos (hwnd, data, x_pos, y_pos);
@@ -737,7 +736,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
int x_pos = LOSWORD (lParam);
int y_pos = HISWORD (lParam);
const WINDOWINFO* winfo = GetWindowInfo(hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
ScreenToClient (hwnd, &x_pos, &y_pos);
track_thumb (hwnd, data, x_pos, y_pos);
@@ -778,7 +777,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
int scancode = (int)wParam;
int notification_code = 0;
const WINDOWINFO* winfo = GetWindowInfo(hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
switch (scancode)
{
@@ -911,7 +910,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case MSG_KILLFOCUS:
{
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data->status &= ~SBS_HILITE_THUMB;
// DK: Make the background does't redraw.
InvalidateRect(hwnd, NULL, FALSE);
@@ -928,7 +927,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
pCtrl = (PCONTROL)hwnd;
caret = pCtrl->pCaretInfo;
winfo = GetWindowInfo(hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
status = SBS_HILITE_THUMB;
if (!data || !caret)
@@ -996,7 +995,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case SBM_GETPOS:
{
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
return data->curPos;
}
@@ -1004,7 +1003,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int pos = (int)wParam;
BOOL redraw = (BOOL)lParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if (pos == data->curPos)
return 0;
@@ -1049,7 +1048,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case SBM_GETSCROLLINFO:
{
PSCROLLINFO info = (PSCROLLINFO) wParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if (info->fMask & SIF_RANGE)
{
@@ -1070,7 +1069,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
BOOL redraw = (BOOL)lParam;
int new_nPos, new_nMin, new_nMax;
UINT new_nPage;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
new_nPos = data->curPos;
new_nMin = data->minPos;
@@ -1081,7 +1080,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
if (info->nMax < info->nMin)
{
_MG_PRINTF ( "Error range\n");
_WRN_PRINTF ( "Error range");
return -1;
}
new_nMin = info->nMin;
@@ -1093,7 +1092,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (info->nPage > new_nMax - new_nMin + 1
|| info->nPage <= 0)
{
_MG_PRINTF ( "Error page step\n");
_WRN_PRINTF ( "Error page step");
return -1;
}
new_nPage = info->nPage;
@@ -1112,7 +1111,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (info->nPos < new_nMin ||
info->nPos > new_nMax)
{
_MG_PRINTF ( "Error postion to set");
_WRN_PRINTF ( "Error postion to set");
return -1;
}
new_nPos = info->nPos;
@@ -1155,7 +1154,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int *min = (int *)wParam;
int *max = (int *)lParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
*min = data->minPos;
*max = data->maxPos;
@@ -1167,11 +1166,11 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int min = (int) wParam;
int max = (int) lParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if(max < data->curPos || min > data->curPos)
{
_MG_PRINTF ( "Error range to set\n");
_WRN_PRINTF ( "Error range to set");
return -1;
}
data->minPos = min;
@@ -1196,11 +1195,11 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int min = (int) wParam;
int max = (int) lParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if(max < data->curPos || min > data->curPos)
{
_MG_PRINTF ( "Error range to set\n");
_WRN_PRINTF ( "Error range to set");
return -1;
}
data->minPos = min;
@@ -1228,7 +1227,7 @@ static LRESULT ScrollBarCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
int which = (int)wParam;
BOOL enable = (BOOL)lParam;
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
data = (PSCROLLBARDATA) GetWindowAdditionalData2 (hwnd);
if (which & SB_ARROW_LTUP)
{
+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)
+31 -8
View File
@@ -2,23 +2,46 @@ SUBDIRS = in-core
noinst_LTLIBRARIES = libfont.la
SRC_FILES = charset.c charset-arabic.c charset-bidi.c \
SRC_FILES = charset.c charset-arabic.c legacy-bidi.c charset-unicode.c \
unicode-comp.c unicode-script.c language-code.c \
sysfont.c logfont.c devfont.c fontname.c \
rawbitmap.c varbitmap.c qpf.c upf.c \
nullfont.c rawbitmap.c varbitmap.c qpf.c upf.c \
fontcache.c freetype2.c font-engines.c\
gbunimap.c gbkunimap.c gb18030unimap.c big5unimap.c \
ujisunimap.c sjisunimap.c euckrunimap.c \
textops.c mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
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 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)
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)
+11 -8
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,
@@ -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,
@@ -547,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) {
@@ -641,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;
+87 -74
View File
@@ -51,7 +51,7 @@ typedef struct _SHAPEINFO {
#define MAX_GLYPH_VALUE 0x133
#define SHAPENUMBER 36
static const SHAPEINFO shape_info[SHAPENUMBER] = {
/* Base Isol Final Initial Medial */
/* Base Isol Final Initial Medial */
{ /* 0 0xC1 (0x0621) */ 0xC1/*0xFE80*/, 0x00, 0x00, 0x00 /* Arabic letter Hamza */ },
{ /* 1 0xC2 (0x0622) */ 0xC2/*0xFE81*/, 0x102/*0xFE82*/, 0x00, 0x00 /* Arabic letter Alef with Madda above */ },
{ /* 2 0xC3 (0x0623) */ 0xC3/*0xFE83*/, 0x103/*0xFE84*/, 0x00, 0x00 /* Arabic letter Alef with Hamza above */ },
@@ -94,9 +94,9 @@ static const SHAPEINFO shape_info[SHAPENUMBER] = {
static int iso8859_6_is_this_charset (const unsigned char* charset)
{
int i;
char name [LEN_FONT_NAME + 1];
char name [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < LEN_FONT_NAME + 1; i++) {
for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -174,17 +174,19 @@ static unsigned short iso8859_68x_unicode_map [] =
0xFEF7, 0xFEF8, 0xFEF9, 0xFEFA, /*0x130~0x133*/
};
static UChar32 iso8859_6_conv_to_uc32 (Glyph32 glyph_value)
static Uchar32 iso8859_6_conv_to_uc32 (Achar32 chv)
{
if (glyph_value < 0x81)
return (Glyph32) (glyph_value);
else if (glyph_value <= MAX_GLYPH_VALUE )
return (Glyph32) iso8859_68x_unicode_map[glyph_value - 0x81];
chv = REAL_ACHAR(chv);
if (chv < 0x81)
return (Achar32) (chv);
else if (chv <= MAX_GLYPH_VALUE )
return (Achar32) iso8859_68x_unicode_map[chv - 0x81];
else
return 0xFFFF;
}
static int iso8859_6_conv_from_uc32 (UChar32 wc, unsigned char* mchar)
static int iso8859_6_conv_from_uc32 (Uchar32 wc, unsigned char* mchar)
{
switch (wc) {
case 0x060C:
@@ -212,8 +214,8 @@ static int iso8859_6_conv_from_uc32 (UChar32 wc, unsigned char* mchar)
}
#endif
/* must attetion the para s is arabic glyph value.*/
static int is_arabic_glyph_vowel(Uint8 c)
/* must attetion the para s is arabic chv value.*/
static int is_arabic_char_vowel(Uint8 c)
{
if ((c >= 0x81) && (c <= 0x86)) return 1;
@@ -256,7 +258,7 @@ static int is_arabic_glyph_vowel(Uint8 c)
/* this define is relative with fontset 0xa1~0xa7.
* it it used for ligature such as LAM+ALEF, one ligature
* have two fontset glyphs.*/
* have two fontset chvs.*/
#define LAM_ALIF 0x12C //0xA1A5
#define LAM_ALIF_F 0x12D //0xA1A6
@@ -272,15 +274,15 @@ static int is_arabic_glyph_vowel(Uint8 c)
/* Because the get_ligature is close relative with fontset 6.8x, so
* do it in the follow five functions, if the fontset is change, you only
* need to implement follow five interface.
* 1. get_vowel_glyph().
* 2. get_twovowel_glyph().
* 3. get_tadweel_glyph().
* 4. get_ligature_glyph().
* 5. get_punpoint_glyph().
* 1. get_vowel_char().
* 2. get_twovowel_char().
* 3. get_tadweel_char().
* 4. get_ligature_char().
* 5. get_punpoint_char().
* houhh 20080128.
* */
static int fontset_68x_get_punpoint_glyph(Uint8 c)
static int fontset_68x_get_punpoint_char(Uint8 c)
{
int ligature = -1;
switch(c){
@@ -293,7 +295,7 @@ static int fontset_68x_get_punpoint_glyph(Uint8 c)
return ligature;
}
static int fontset_68x_get_vowel_glyph(Uint8 c)
static int fontset_68x_get_vowel_char(Uint8 c)
{
int ligature = -1;
switch(c){
@@ -310,7 +312,7 @@ static int fontset_68x_get_vowel_glyph(Uint8 c)
return ligature;
}
static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, int* ignore)
static int fontset_68x_get_twovowel_char(unsigned char c, unsigned char next, int* ignore)
{
int ligature = -1;
if(c == SHADDA){
@@ -326,12 +328,12 @@ static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, i
}
else {
*ignore = 0;
ligature = fontset_68x_get_vowel_glyph(c);
ligature = fontset_68x_get_vowel_char(c);
}
return ligature;
}
static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joining, int* ignore)
static int fontset_68x_get_ligature_char(unsigned char c, BOOL prev_affects_joining, int* ignore)
{
int ligature = -1;
if(prev_affects_joining){
@@ -355,7 +357,7 @@ static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joi
return ligature;
}
static int fontset_68x_get_tadweel_glyph(unsigned char c, unsigned char next, int* ignore)
static int fontset_68x_get_tadweel_char(unsigned char c, unsigned char next, int* ignore)
{
int ligature = -1;
if(c == SHADDA){
@@ -400,12 +402,12 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
cur_char = *mchar;
ligature = fontset_68x_get_punpoint_glyph(cur_char);
ligature = fontset_68x_get_punpoint_char(cur_char);
if(ligature > 0) return ligature;
if(len == 1){
if (ISARABIC_VOWEL(cur_char)){
ligature = fontset_68x_get_vowel_glyph(cur_char);
ligature = fontset_68x_get_vowel_char(cur_char);
}
else if(cur_char == TADWEEL){
ligature = TADWEEL;
@@ -414,16 +416,16 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
else if(len > 1){
next = *(mchar+1);
if (ISARABIC_VOWEL(cur_char)){ /* two VOWEL, one must be SHADDA first. */
ligature = fontset_68x_get_twovowel_glyph(cur_char, next, ignore);
ligature = fontset_68x_get_twovowel_char(cur_char, next, ignore);
}
else if (cur_char == LAM) { /* LAM+ALEF+HAMAZ+MADDA ligature. */
ligature = fontset_68x_get_ligature_glyph(next, prev_affects_joining, ignore);
ligature = fontset_68x_get_ligature_char(next, prev_affects_joining, ignore);
}
else if(cur_char == TADWEEL){ /* TADWEEL combine with VOWEL*/
if(len > 2) next_next = *(mchar+2);
else next_next = 0;
ligature = fontset_68x_get_tadweel_glyph(next, next_next, ignore);
ligature = fontset_68x_get_tadweel_char(next, next_next, ignore);
if(ligature == -1 && cur_char == TADWEEL){
ligature = TADWEEL;
}
@@ -454,21 +456,22 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
static unsigned int iso8859_6_glyph_type (Glyph32 glyph_value)
static unsigned int iso8859_6_char_type (Achar32 chv)
{
unsigned int ch_type = MCHAR_TYPE_UNKNOWN;
unsigned int ch_type = ACHAR_BASIC_UNKNOWN;
if (is_arabic_glyph_vowel (glyph_value)){ /* is vowel */
ch_type = MCHAR_TYPE_VOWEL;
if (is_arabic_char_vowel (chv)) { /* is vowel */
ch_type = ACHAR_BASIC_VOWEL;
}
else{
ch_type = sb_glyph_type (glyph_value);
ch_type = sb_char_type (chv);
}
return ch_type;
}
static Uint32 __mg_iso8859_68x_type[] = {
static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -504,6 +507,7 @@ static Uint32 __mg_iso8859_68x_type[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
/*0x60~0x6f*/
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
@@ -515,6 +519,7 @@ static Uint32 __mg_iso8859_68x_type[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
@@ -586,9 +591,13 @@ static Uint32 __mg_iso8859_68x_type[] = {
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
};
static unsigned int iso8859_6_bidi_glyph_type (Glyph32 glyph_value)
static BidiType iso8859_6_bidi_char_type (Achar32 chv)
{
return __mg_iso8859_68x_type [REAL_GLYPH(glyph_value)];
chv = REAL_ACHAR(chv);
if (chv > 0x7F)
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
else
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
}
static int get_table_index(Uint8 c)
@@ -652,7 +661,11 @@ static int get_next_char(const unsigned char* mchar, int len)
return next_char;
}
Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, int prev_len, const unsigned char* mchar, int len)
#ifndef _DEBUG
static
#endif
Achar32 iso8859_6_get_char_value (const unsigned char* prev_mchar,
int prev_len, const unsigned char* mchar, int len)
{
BOOL next_affects_joining = FALSE, prev_affects_joining = FALSE;
int char_index, prev_index;
@@ -665,15 +678,15 @@ Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, int prev_le
char_index = get_table_index(*mchar);
/*current glyph has no transfiguration and has no ligature*/
/*current chv has no transfiguration and has no ligature*/
if (char_index < 0 && !ISARABIC_PUNC(*mchar)
&& !ISARABIC_VOWEL(*mchar) && !(*mchar == TADWEEL)) {
return *mchar;
}
if(prev_mchar){
if (prev_mchar) {
prev_index = get_table_index(*prev_mchar);
prev_affects_joining = ( prev_index >= 0 || is_char_transparent(*prev_mchar)) && (shape_info[prev_index].medial);
prev_affects_joining = (prev_index >= 0 || is_char_transparent(*prev_mchar)) && (shape_info[prev_index].medial);
// NUV prev_char = *prev_mchar;
/*houhh 20080505, check if ligature. */
if(prev_affects_joining) {
@@ -768,57 +781,57 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
/*if cur_len>1, search ligature shape,
* else search letter or phonetic symbol shape*/
static Glyph32 iso8859_6_glyph_shape (const unsigned char* cur_mchar,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type)
{
Glyph32 glyph_value = -1;
Achar32 chv = -1;
int ignore;
int index;
if (cur_len > 1)
{
if (shape_type == GLYPH_ISOLATED)
glyph_value = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
else if (shape_type != GLYPH_INITIAL) {
if (shape_type == ACHAR_ISOLATED)
chv = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
else if (shape_type != ACHAR_INITIAL) {
/* LAM+ALEF+HAMAZ+MADDA ligature. */
if (*cur_mchar == LAM)
glyph_value = fontset_68x_get_ligature_glyph(*(cur_mchar+1), TRUE, &ignore);
chv = fontset_68x_get_ligature_char(*(cur_mchar+1), TRUE, &ignore);
}
}
if (glyph_value == -1 || glyph_value == 0) {
if (chv == -1 || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){
glyph_value = fontset_68x_get_vowel_glyph(*cur_mchar);
chv = fontset_68x_get_vowel_char(*cur_mchar);
}
if (glyph_value == 0 || glyph_value == -1) {
if (chv == 0 || chv == -1) {
index = get_table_index(*cur_mchar);
if (index >=0)
{
switch (shape_type) {
case GLYPH_ISOLATED:
glyph_value = shape_info[index].isolated;
case ACHAR_ISOLATED:
chv = shape_info[index].isolated;
break;
case GLYPH_FINAL:
glyph_value = shape_info[index].final;
case ACHAR_FINAL:
chv = shape_info[index].final;
break;
case GLYPH_INITIAL:
glyph_value = shape_info[index].initial;
case ACHAR_INITIAL:
chv = shape_info[index].initial;
break;
case GLYPH_MEDIAL:
glyph_value = shape_info[index].medial;
case ACHAR_MEDIAL:
chv = shape_info[index].medial;
break;
}
}
else
glyph_value = *cur_mchar;
chv = *cur_mchar;
}
}
if (glyph_value == 0)
glyph_value =-1;
if (chv == 0)
chv =-1;
return glyph_value;
return chv;
}
static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
@@ -835,10 +848,10 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
// {0x00BB, 0x00AB}
};
static BOOL iso8859_6_bidi_mirror_glyph (Glyph32 glyph, Glyph32* mirrored)
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{
return get_mirror_glyph (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), glyph, mirrored);
return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
}
static CHARSETOPS CharsetOps_iso8859_6 = {
@@ -847,16 +860,16 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
FONT_CHARSET_ISO8859_6,
0,
iso8859_6_len_first_char,
iso8859_6_char_glyph_value,
iso8859_6_glyph_shape,
iso8859_6_glyph_type,
iso8859_6_get_char_value,
iso8859_6_get_shaped_char_value,
iso8859_6_char_type,
sb_nr_chars_in_str,
iso8859_6_is_this_charset,
sb_len_first_substr,
iso8859_6_get_next_word,
sb_pos_first_char,
iso8859_6_bidi_glyph_type,
iso8859_6_bidi_mirror_glyph,
iso8859_6_bidi_char_type,
iso8859_6_bidi_mirror_char,
#ifdef _MGCHARSET_UNICODE
iso8859_6_conv_to_uc32,
iso8859_6_conv_from_uc32
@@ -864,14 +877,14 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
};
#ifdef _DEBUG
int test_glyph_value (int char_index, Glyph32 glyph_value)
int iso8859_6_test_chv (int char_index, Achar32 chv)
{
int i = 0;
for (i = 0; i<SHAPENUMBER; i++) {
if (shape_info[i].isolated == glyph_value ||
shape_info[i].initial == glyph_value ||
shape_info[i].medial == glyph_value ||
shape_info[i].final == glyph_value )
if (shape_info[i].isolated == chv ||
shape_info[i].initial == chv ||
shape_info[i].medial == chv ||
shape_info[i].final == chv )
if( char_index == i)
return 1;
}
File diff suppressed because it is too large Load Diff
+305 -1070
View File
File diff suppressed because it is too large Load Diff
+333 -105
View File
File diff suppressed because it is too large Load Diff
+284
View File
@@ -0,0 +1,284 @@
#line 1 "emoji_presentation_scanner.rl"
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#line 9 "emoji_presentation_scanner.c"
static const char _emoji_presentation_actions[] = {
0, 1, 0, 1, 1, 1, 5, 1,
6, 1, 7, 1, 8, 1, 9, 1,
10, 1, 11, 2, 2, 3, 2, 2,
4
};
static const char _emoji_presentation_key_offsets[] = {
0, 5, 7, 14, 18, 20, 21, 24,
29, 30, 34, 36
};
static const unsigned char _emoji_presentation_trans_keys[] = {
3u, 7u, 13u, 0u, 2u, 14u, 15u, 2u,
3u, 6u, 7u, 13u, 0u, 1u, 9u, 10u,
11u, 12u, 10u, 12u, 10u, 4u, 10u, 12u,
4u, 9u, 10u, 11u, 12u, 6u, 9u, 10u,
11u, 12u, 8u, 10u, 9u, 10u, 11u, 12u,
14u, 0
};
static const char _emoji_presentation_single_lengths[] = {
3, 2, 5, 4, 2, 1, 3, 5,
1, 4, 2, 5
};
static const char _emoji_presentation_range_lengths[] = {
1, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
static const char _emoji_presentation_index_offsets[] = {
0, 5, 8, 15, 20, 23, 25, 29,
35, 37, 42, 45
};
static const char _emoji_presentation_indicies[] = {
2, 1, 1, 1, 0, 4, 5, 3,
7, 8, 10, 11, 12, 6, 9, 5,
13, 14, 15, 0, 13, 15, 16, 13,
16, 15, 13, 15, 16, 15, 5, 13,
14, 15, 16, 5, 17, 5, 13, 14,
18, 17, 5, 13, 16, 5, 13, 14,
15, 4, 16, 0
};
static const char _emoji_presentation_trans_targs[] = {
2, 4, 6, 2, 1, 2, 3, 3,
7, 2, 8, 9, 11, 0, 2, 5,
2, 2, 10
};
static const char _emoji_presentation_trans_actions[] = {
17, 19, 19, 15, 0, 7, 22, 19,
19, 9, 0, 22, 19, 0, 5, 19,
11, 13, 19
};
static const char _emoji_presentation_to_state_actions[] = {
0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
static const char _emoji_presentation_from_state_actions[] = {
0, 0, 3, 0, 0, 0, 0, 0,
0, 0, 0, 0
};
static const char _emoji_presentation_eof_trans[] = {
1, 4, 0, 1, 17, 17, 17, 17,
18, 18, 17, 17
};
static const int emoji_presentation_start = 2;
static const int emoji_presentation_en_text_and_emoji_run = 2;
#line 9 "emoji_presentation_scanner.rl"
#line 78 "emoji_presentation_scanner.rl"
static emoji_text_iter_t
scan_emoji_presentation (emoji_text_iter_t p,
const emoji_text_iter_t pe,
bool* is_emoji)
{
emoji_text_iter_t ts, te;
const emoji_text_iter_t eof = pe;
unsigned act;
int cs;
#line 107 "emoji_presentation_scanner.c"
{
cs = emoji_presentation_start;
ts = 0;
te = 0;
act = 0;
}
#line 115 "emoji_presentation_scanner.c"
{
int _klen;
unsigned int _trans;
const char *_acts;
unsigned int _nacts;
const unsigned char *_keys;
if ( p == pe )
goto _test_eof;
_resume:
_acts = _emoji_presentation_actions + _emoji_presentation_from_state_actions[cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 ) {
switch ( *_acts++ ) {
case 1:
#line 1 "NONE"
{ts = p;}
break;
#line 134 "emoji_presentation_scanner.c"
}
}
_keys = _emoji_presentation_trans_keys + _emoji_presentation_key_offsets[cs];
_trans = _emoji_presentation_index_offsets[cs];
_klen = _emoji_presentation_single_lengths[cs];
if ( _klen > 0 ) {
const unsigned char *_lower = _keys;
const unsigned char *_mid;
const unsigned char *_upper = _keys + _klen - 1;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + ((_upper-_lower) >> 1);
if ( (*p) < *_mid )
_upper = _mid - 1;
else if ( (*p) > *_mid )
_lower = _mid + 1;
else {
_trans += (unsigned int)(_mid - _keys);
goto _match;
}
}
_keys += _klen;
_trans += _klen;
}
_klen = _emoji_presentation_range_lengths[cs];
if ( _klen > 0 ) {
const unsigned char *_lower = _keys;
const unsigned char *_mid;
const unsigned char *_upper = _keys + (_klen<<1) - 2;
while (1) {
if ( _upper < _lower )
break;
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
if ( (*p) < _mid[0] )
_upper = _mid - 2;
else if ( (*p) > _mid[1] )
_lower = _mid + 2;
else {
_trans += (unsigned int)((_mid - _keys)>>1);
goto _match;
}
}
_trans += _klen;
}
_match:
_trans = _emoji_presentation_indicies[_trans];
_eof_trans:
cs = _emoji_presentation_trans_targs[_trans];
if ( _emoji_presentation_trans_actions[_trans] == 0 )
goto _again;
_acts = _emoji_presentation_actions + _emoji_presentation_trans_actions[_trans];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 )
{
switch ( *_acts++ )
{
case 2:
#line 1 "NONE"
{te = p+1;}
break;
case 3:
#line 74 "emoji_presentation_scanner.rl"
{act = 2;}
break;
case 4:
#line 75 "emoji_presentation_scanner.rl"
{act = 3;}
break;
case 5:
#line 73 "emoji_presentation_scanner.rl"
{te = p+1;{ *is_emoji = false; return te; }}
break;
case 6:
#line 74 "emoji_presentation_scanner.rl"
{te = p+1;{ *is_emoji = true; return te; }}
break;
case 7:
#line 75 "emoji_presentation_scanner.rl"
{te = p+1;{ *is_emoji = false; return te; }}
break;
case 8:
#line 74 "emoji_presentation_scanner.rl"
{te = p;p--;{ *is_emoji = true; return te; }}
break;
case 9:
#line 75 "emoji_presentation_scanner.rl"
{te = p;p--;{ *is_emoji = false; return te; }}
break;
case 10:
#line 74 "emoji_presentation_scanner.rl"
{{p = ((te))-1;}{ *is_emoji = true; return te; }}
break;
case 11:
#line 1 "NONE"
{ switch( act ) {
case 2:
{{p = ((te))-1;} *is_emoji = true; return te; }
break;
case 3:
{{p = ((te))-1;} *is_emoji = false; return te; }
break;
}
}
break;
#line 248 "emoji_presentation_scanner.c"
}
}
_again:
_acts = _emoji_presentation_actions + _emoji_presentation_to_state_actions[cs];
_nacts = (unsigned int) *_acts++;
while ( _nacts-- > 0 ) {
switch ( *_acts++ ) {
case 0:
#line 1 "NONE"
{ts = 0;}
break;
#line 261 "emoji_presentation_scanner.c"
}
}
if ( ++p != pe )
goto _resume;
_test_eof: {}
if ( p == eof )
{
if ( _emoji_presentation_eof_trans[cs] > 0 ) {
_trans = _emoji_presentation_eof_trans[cs] - 1;
goto _eof_trans;
}
}
}
#line 94 "emoji_presentation_scanner.rl"
/* Should not be reached. */
ts = ts + 0; // suppress compilation warning.
*is_emoji = false;
return pe;
}
+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
+33 -78
View File
@@ -43,20 +43,11 @@
#include "common.h"
#ifdef _MGFONT_TTF_CACHE
#if defined(_MGFONT_FT2) && defined(_MGFONT_TTF_CACHE)
#include "minigui.h"
#include "gdi.h"
#ifdef _MGFONT_TTF
#include <freetype/freetype.h>
#include <freetype/ftxkern.h>
#include <freetype/ftnameid.h>
#include <freetype/ftxcmap.h>
#include <freetype/ftxwidth.h>
#include "freetype.h"
#else
#include "freetype2.h"
#endif
typedef struct _MemBlk {
void *data;
@@ -85,15 +76,12 @@ typedef struct _HashDirectory {
*hashDir : the hash directory pointer
lruQueueDummyHead : head node of lru queue
makeHashKeyFunc : the function which make hash key */
typedef struct cache {
typedef struct _FontCache {
/* Information about font */
char family[LEN_FONT_NAME + 1];
// VincentWei: no need to check charset for TrueType
//char charset[LEN_FONT_NAME + 1];
int render_style; // render style
char df_name[LEN_UNIDEVFONT_NAME + 1];
int style;
int fontsize;
int rotation;
int refers;
int blkSize;
int nBlk;
@@ -103,7 +91,7 @@ typedef struct cache {
HashDirectory *hashDir;
LruQueueDummyHead lruQueueDummyHead;
MakeHashKeyFunc makeHashKeyFunc;
} cache_t;
} FontCache;
/* Least-Recently-Used-Order
global cache LRU queue */
@@ -111,7 +99,7 @@ typedef struct _CacheQueueNode
{
/* hold global cache queue
max cache node maybe 10 */
cache_t cache;
FontCache cache;
struct _CacheQueueNode *prevCache;
struct _CacheQueueNode *nextCache;
}CacheQueueNode;
@@ -149,7 +137,7 @@ AppendCache(CacheQueueNode *new)
/* create a new LRU-Queue. */
static int
CreateCacheLruQueue(cache_t *cache, int nblk)
CreateCacheLruQueue(FontCache *cache, int nblk)
{
int i;
MemBlk *blk;
@@ -221,7 +209,7 @@ InitCache(CacheQueueNode *new, int ndir, int nblock)
static void
LruQueueBufferSplit(cache_t *cache, int bufsize)
LruQueueBufferSplit(FontCache *cache, int bufsize)
{
MemBlk *blk;
unsigned char *buff;
@@ -236,7 +224,7 @@ LruQueueBufferSplit(cache_t *cache, int bufsize)
}
static void
DestroyCache(cache_t *cache)
DestroyCache(FontCache *cache)
{
if (cache->hashDir != NULL) {
free(cache->hashDir);
@@ -325,7 +313,7 @@ GetCache(int nblock, int ndir)
lru-queue and also Hash queue(anywhere in hash q).
Relink the lru queue and hash queue */
static MemBlk *
PickOffBlk(cache_t *cache)
PickOffBlk(FontCache *cache)
{
MemBlk *blk;
@@ -352,7 +340,7 @@ PickOffBlk(cache_t *cache)
}
static void
AppendBlk(cache_t *cache, MemBlk *blk, int key)
AppendBlk(FontCache *cache, MemBlk *blk, int key)
{
/* first, append the blcok at the end of the
lru-queue. */
@@ -381,7 +369,7 @@ AppendBlk(cache_t *cache, MemBlk *blk, int key)
*size : if found the data, how long is the data(return val)
reutrn = pointer to the data */
TTFCACHEINFO *
__mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
__mg_ttc_search(HCACHE hCache, Glyph32 gv, int *size)
{
int key;
CacheQueueNode *ca;
@@ -391,7 +379,7 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
return NULL;
}
ca = (CacheQueueNode *)(hCache);
key = ca->cache.makeHashKeyFunc(unicode);
key = ca->cache.makeHashKeyFunc(gv);
if (key > (ca->cache.nDir - 1)) {
return NULL;
}
@@ -399,7 +387,8 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
for ( ; blk != &(ca->cache.hashDir[key].hashHead);
blk = blk->hashNext) {
if (*(unsigned short *)(blk->data) == unicode) {
TTFCACHEINFO* tci = (TTFCACHEINFO*)blk->data;
if (tci->glyph_code == gv) {
/* If found the blk, we should pick off it
and link it at the end of LRU-q */
*size = blk->len;
@@ -409,17 +398,18 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
blk->lruPrev = ca->cache.lruQueueDummyHead.lruPrev;
(ca->cache.lruQueueDummyHead.lruPrev)->lruNext = blk;
ca->cache.lruQueueDummyHead.lruPrev = blk;
return blk->data;
return tci;
}
}
return NULL;
}
/* add data into a speicial cache
/* add data into the specific cache
hCache : which cache ,
*data : your data pointer
size : your data's bytes
key : hash key of your data */
key : hash key of your data
*/
int
__mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
{
@@ -434,7 +424,7 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
if (ca->cache.blkSize < size) {
return -1;
}
key = ca->cache.makeHashKeyFunc(*(unsigned short *)data);
key = ca->cache.makeHashKeyFunc(data->glyph_code);
/* pick off a block from lru queue */
if ((blk = PickOffBlk(&ca->cache)) == NULL) {
@@ -461,12 +451,11 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
ndir : how many hash entries in the cache
makeHashKey : the function which make the hash key */
HCACHE
__mg_ttc_create(char *family, char *charset,
DWORD style, int size, int rotation,
__mg_ttc_create(const char *df_name, int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey)
{
CacheQueueNode *temp;
if (family == NULL || /* charset == NULL || */makeHashKey == NULL) {
if (df_name == NULL || makeHashKey == NULL) {
return (HCACHE)(0);
}
if (nblk <= 0 || blksize <= 0 || size <= 0 || ndir <= 0) {
@@ -480,9 +469,9 @@ __mg_ttc_create(char *family, char *charset,
return (HCACHE)(0);
}
strncpy(temp->cache.family, family, LEN_FONT_NAME);
//strncpy(temp->cache.charset, charset, LEN_FONT_NAME);
temp->cache.render_style = (style & FS_RENDER_MASK);
memset(temp->cache.df_name, 0, LEN_UNIDEVFONT_NAME + 1);
strncpy(temp->cache.df_name, df_name, LEN_UNIDEVFONT_NAME);
temp->cache.style = style & FS_RENDER_MASK;
temp->cache.fontsize = size;
temp->cache.rotation = rotation;
temp->cache.blkSize = blksize;
@@ -572,11 +561,8 @@ __mg_ttc_sys_deinit(void)
}
}
HCACHE
__mg_ttc_is_exist(char *family, char *charset,
DWORD style, int size, int rotation)
__mg_ttc_is_exist(const char *df_name, int style, int size, int rotation)
{
CacheQueueNode *p;
@@ -584,44 +570,17 @@ __mg_ttc_is_exist(char *family, char *charset,
return (HCACHE)0;
}
#if 0 // VincentWei: Use FS_RENDER_MASK insead (3.4.0)
/* If can not match font name*/
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0) {
if (strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0) {
if (p->cache.fontsize == size) {
int s = style & 0x000000FF;
if ((s == FS_WEIGHT_BOOK || s == FS_WEIGHT_DEMIBOLD || s == FS_WEIGHT_SUBPIXEL) &&
(p->cache.style == FS_WEIGHT_BOOK || p->cache.style == FS_WEIGHT_DEMIBOLD ||
p->cache.style == FS_WEIGHT_SUBPIXEL)) {
return (HCACHE) p;
}
if ((s != FS_WEIGHT_BOOK && s != FS_WEIGHT_DEMIBOLD && s != FS_WEIGHT_SUBPIXEL) &&
(p->cache.style != FS_WEIGHT_BOOK && p->cache.style != FS_WEIGHT_DEMIBOLD &&
p->cache.style != FS_WEIGHT_SUBPIXEL)) {
return (HCACHE) p;
}
}
}
p = p->nextCache;
}
#else
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0
#if 0 // VincentWei: do not need to check charset.
&& strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0
#endif
if (strncmp(p->cache.df_name, df_name, LEN_UNIDEVFONT_NAME) == 0
&& p->cache.style == (style & FS_RENDER_MASK)
&& p->cache.fontsize == size
&& p->cache.rotation == rotation
&& (style & FS_RENDER_MASK) == p->cache.render_style) {
&& p->cache.rotation == rotation) {
return (HCACHE) p;
}
p = p->nextCache;
}
#endif
return (HCACHE)0;
}
@@ -675,15 +634,13 @@ void __mg_ttc_dump_all(void)
}
}
void __mg_ttc_dump(cache_t *cache)
void __mg_ttc_dump(FontCache *cache)
{
int i, j, k;
MemBlk *ptr;
#if 0
DP(("&cache = %p\n", cache));
DP(("cache.family = %s\n", cache->family));
DP(("cache.charset = %s\n", cache->charset));
DP(("cache.style = %d\n", cache->style));
DP(("cache.df_name = %s\n", cache->df_name));
DP(("cache.fontsize = %d\n", cache->fontsize));
DP(("cache.blkSize = %d\n", cache->blkSize));
DP(("cache.refers = %d\n", cache->refers));
@@ -729,7 +686,6 @@ void
__mg_ttc_dump_cacheinfo(TTFCACHEINFO *ca)
{
DP(("Dump TTFCACHEINFO %p...\n", ca));
DP(("cacheInfo->unicode = %d\n", ca->unicode));
DP(("cacheInfo->glyph_code = %d\n", ca->glyph_code));
DP(("cacheInfo->cur_xmin = %d, cacheInfo->cur_ymin = %d\n",
@@ -748,7 +704,6 @@ void
__mg_ttc_dump_instance(TTFINSTANCEINFO *in)
{
DP(("Dump TTFINSTANCEINFO %p...\n", in));
DP(("Instance->cur_unicode = %d\n", in->cur_unicode));
DP(("Instance->cur_glyph_code = %d\n", in->cur_glyph_code));
DP(("Instance->outline(addr) = %p\n", &in->cur_outline));
DP(("Instance->cur_xmin = %d, Instance->cur_ymin = %d\n",
@@ -765,5 +720,5 @@ __mg_ttc_dump_instance(TTFINSTANCEINFO *in)
#endif /* 0 */
#endif /* _MGFONT_TTF_CACHE */
#endif /* defined(_MGFONT_FT2) && defined(_MGFONT_TTF_CACHE) */
+175 -29
View File
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "common.h"
#include "minigui.h"
@@ -70,7 +71,7 @@ int fontConvertFontType (const char* type)
if (strcasecmp (type, FONT_TYPE_NAME_SCALE_T1F) == 0)
return FONT_TYPE_SCALE_T1F;
if (strcasecmp (type, FONT_TYPE_NAME_ALL) == 0)
return FONT_TYPE_ALL;
return FONT_TYPE_ANY;
return -1;
}
@@ -96,7 +97,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type)
int fontGetFontTypeFromName (const char* name)
{
char type [LEN_FONT_NAME + 1];
char type [LEN_LOGFONT_NAME_FIELD + 1];
if (!fontGetTypeNameFromName (name, type))
return -1;
@@ -114,8 +115,8 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
if (*(++family_part) == '\0')
return FALSE;
while (family_part [i] && i <= LEN_FONT_NAME) {
if (family_part [i] == '-') {
while (family_part [i] && i <= LEN_LOGFONT_FAMILY_FIELD) {
if (family_part [i] == '-'/* || family_part [i] == ',' */) {
family [i] = '\0';
break;
}
@@ -127,6 +128,99 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
return TRUE;
}
static BOOL get_family_part_lower (const char* name, char* family)
{
int i = 0;
const char* family_part;
if ((family_part = strchr (name, '-')) == NULL)
return FALSE;
if (*(++family_part) == '\0')
return FALSE;
while (family_part [i] && i <= LEN_UNIDEVFONT_NAME) {
if (family_part [i] == '-') {
family [i] = '\0';
break;
}
family [i] = tolower(family_part [i]);
i++;
}
return TRUE;
}
#if 0
static const char *my_strstr(const char *haystack, const char *needle)
{
int i = 0, j = 0;
int tmp = i;
int str_len = strlen(haystack);
int substr_len = strlen(needle);
for (i = 0; i < str_len - substr_len; i++) {
tmp = i;
for (j = 0; j < substr_len; j++) {
if (haystack[tmp] == needle[j]) {
if (j == substr_len - 1)
return haystack + i;
tmp++;
}
else
break;
}
}
return NULL;
}
#endif
/* devfont family specification:
* family[,alias]...
*/
BOOL fontDoesMatchFamily (const char* name, const char* family)
{
// make sure there is a redundant space for the head and tail characters.
char family_part[LEN_LOGFONT_FAMILY_FIELD + 3];
char family_request[LEN_LOGFONT_NAME_FIELD + 3];
int i;
size_t len;
// add ',' to the head
family_part[0] = ',';
if (!get_family_part_lower(name, family_part + 1)) {
return FALSE;
}
// add ',' to the tail
len = strlen(family_part);
family_part[len] = ',';
family_part[len + 1] = '\0';
// make family (lowercase)
family_request[0] = ',';
i = 0;
while (family[i] && i < LEN_LOGFONT_NAME_FIELD) {
family_request[i + 1] = tolower(family[i]);
i++;
}
family_request[i + 1] = '\0';
// add ',' to the tail
len = strlen(family_request);
family_request[len] = ',';
family_request[len + 1] = '\0';
// try to match "<family_request>,"
if (strstr(family_part, family_request)) {
return TRUE;
}
return FALSE;
}
DWORD fontConvertStyle (const char* style_part)
{
DWORD style = 0;
@@ -142,7 +236,7 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_WEIGHT_BOLD:
style |= FS_WEIGHT_BOLD;
break;
/* deprecated since v3.2.1
/* deprecated since v3.4.0
case FONT_WEIGHT_BOOK:
style |= FS_WEIGHT_BOOK;
break;
@@ -156,6 +250,9 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_WEIGHT_REGULAR:
style |= FS_WEIGHT_REGULAR;
break;
case FONT_WEIGHT_NORMAL:
style |= FS_WEIGHT_NORMAL;
break;
case FONT_WEIGHT_LIGHT:
style |= FS_WEIGHT_LIGHT;
break;
@@ -165,7 +262,7 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_WEIGHT_THIN:
style |= FS_WEIGHT_THIN;
break;
/* deprecated since v3.2.1
/* deprecated since v3.4.0
case FONT_WEIGHT_SUBPIXEL:
style |= FS_WEIGHT_SUBPIXEL;
break;
@@ -173,6 +270,7 @@ DWORD fontConvertStyle (const char* style_part)
style |= FS_WEIGHT_MASK;
break;
*/
case FONT_WEIGHT_ANY:
default:
style |= FS_WEIGHT_ANY;
break;
@@ -189,11 +287,10 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_SLANT_ROMAN:
style |= FS_SLANT_ROMAN;
break;
case FONT_SLANT_ALL:
style |= FS_SLANT_MASK;
break;
case FONT_SLANT_ANY:
default:
return 0xFFFFFFFF;
style |= FS_SLANT_ANY;
break;
}
style &= ~FS_FLIP_MASK;
@@ -208,6 +305,7 @@ DWORD fontConvertStyle (const char* style_part)
style |= FS_FLIP_HORZVERT;
break;
default:
//style |= FS_FLIP_NONE;
break;
}
@@ -225,13 +323,8 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_OTHER_TTFNOCACHEKERN:
style |= FS_OTHER_TTFNOCACHEKERN;
break;
case FONT_OTHER_LCDPORTRAIT:
style |= FS_OTHER_LCDPORTRAIT;
break;
case FONT_OTHER_LCDPORTRAITKERN:
style |= FS_OTHER_LCDPORTRAITKERN;
break;
default:
//style |= FS_OTHER_NONE;
break;
}
@@ -245,10 +338,18 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_DECORATE_STRUCKOUT:
style |= FS_DECORATE_STRUCKOUT;
break;
case FONT_DECORATE_BOTH:
style |= FS_DECORATE_BOTH;
case FONT_DECORATE_REVERSE:
style |= FS_DECORATE_REVERSE;
break;
case FONT_DECORATE_OUTLINE:
style |= FS_DECORATE_OUTLINE;
break;
case FONT_DECORATE_US:
style |= FS_DECORATE_UNDERLINE;
style |= FS_DECORATE_STRUCKOUT;
break;
default:
//style |= FS_DECORATE_NONE;
break;
}
@@ -257,9 +358,6 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_RENDER_MONO:
style |= FS_RENDER_MONO;
break;
case FONT_RENDER_OUTLINE:
style |= FS_RENDER_OUTLINE;
break;
case FONT_RENDER_GREY:
style |= FS_RENDER_GREY;
break;
@@ -347,7 +445,7 @@ int fontGetWidthFromName (const char* name)
{
int i;
const char* width_part = name;
char width [LEN_FONT_NAME + 1];
char width [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_WIDTH; i++) {
if ((width_part = strchr (width_part, '-')) == NULL)
@@ -374,11 +472,59 @@ int fontGetWidthFromName (const char* name)
return atoi (width);
}
/* Since 3.4.0; only for LOGFONT name */
char fontGetOrientFromName (const char* name)
{
int i;
const char* orient_part = name;
char orient [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_ORIENT; i++) {
if ((orient_part = strchr (orient_part, '-')) == NULL)
return FONT_ORIENT_UPRIGHT;
if (*(++orient_part) == '\0')
return FONT_ORIENT_UPRIGHT;
}
i = 0;
while (orient_part [i]) {
if (orient_part [i] == '-') {
orient [i] = '\0';
break;
}
orient [i] = orient_part [i];
i++;
}
if (orient_part [i] == '\0')
return FONT_ORIENT_UPRIGHT;
return orient[0];
}
int fontGetOrientPosFromName (const char* name)
{
int i;
const char* orient_part = name;
for (i = 0; i < NR_LOOP_FOR_ORIENT; i++) {
if ((orient_part = strchr (orient_part, '-')) == NULL)
return -1;
if (*(++orient_part) == '\0')
return -1;
}
return orient_part - name;
}
int fontGetHeightFromName (const char* name)
{
int i;
const char* height_part = name;
char height [LEN_FONT_NAME + 1];
char height [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_HEIGHT; i++) {
if ((height_part = strchr (height_part, '-')) == NULL)
@@ -425,8 +571,8 @@ BOOL fontGetCharsetFromName (const char* name, char* charset)
return TRUE;
}
strncpy (charset, charset_part, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -448,8 +594,8 @@ BOOL fontGetCompatibleCharsetFromName (const char* name, char* charset)
if (*(++charset_part) == '\0')
return FALSE;
strncpy (charset, charset_part, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -507,8 +653,8 @@ BOOL charsetGetSpecificCharset (const char* charsets, int _index, char* charset)
return TRUE;
}
strncpy (charset, charsets, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charsets, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
+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
+504 -382
View File
File diff suppressed because it is too large Load Diff
+37 -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 */
@@ -63,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;
@@ -85,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;
@@ -101,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;
@@ -114,38 +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 rotation,
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, int rotation);
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
@@ -1,201 +0,0 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#ifndef __G_UNICODE_H__
#define __G_UNICODE_H__
/* These are the possible character classifications.
* See http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
*/
#if 0 /* VincentWei: Moved to gid.h */
typedef enum
{
G_UNICODE_CONTROL,
G_UNICODE_FORMAT,
G_UNICODE_UNASSIGNED,
G_UNICODE_PRIVATE_USE,
G_UNICODE_SURROGATE,
G_UNICODE_LOWERCASE_LETTER,
G_UNICODE_MODIFIER_LETTER,
G_UNICODE_OTHER_LETTER,
G_UNICODE_TITLECASE_LETTER,
G_UNICODE_UPPERCASE_LETTER,
G_UNICODE_COMBINING_MARK,
G_UNICODE_ENCLOSING_MARK,
G_UNICODE_NON_SPACING_MARK,
G_UNICODE_DECIMAL_NUMBER,
G_UNICODE_LETTER_NUMBER,
G_UNICODE_OTHER_NUMBER,
G_UNICODE_CONNECT_PUNCTUATION,
G_UNICODE_DASH_PUNCTUATION,
G_UNICODE_CLOSE_PUNCTUATION,
G_UNICODE_FINAL_PUNCTUATION,
G_UNICODE_INITIAL_PUNCTUATION,
G_UNICODE_OTHER_PUNCTUATION,
G_UNICODE_OPEN_PUNCTUATION,
G_UNICODE_CURRENCY_SYMBOL,
G_UNICODE_MODIFIER_SYMBOL,
G_UNICODE_MATH_SYMBOL,
G_UNICODE_OTHER_SYMBOL,
G_UNICODE_LINE_SEPARATOR,
G_UNICODE_PARAGRAPH_SEPARATOR,
G_UNICODE_SPACE_SEPARATOR
} GUnicodeType;
#endif /* VincentWei: Moved to gid.h */
/* These are the possible line break classifications.
* Note that new types may be added in the future.
* Implementations may regard unknown values like G_UNICODE_BREAK_UNKNOWN
* See http://www.unicode.org/unicode/reports/tr14/
*/
typedef enum
{
G_UNICODE_BREAK_MANDATORY,
G_UNICODE_BREAK_CARRIAGE_RETURN,
G_UNICODE_BREAK_LINE_FEED,
G_UNICODE_BREAK_COMBINING_MARK,
G_UNICODE_BREAK_SURROGATE,
G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
G_UNICODE_BREAK_INSEPARABLE,
G_UNICODE_BREAK_NON_BREAKING_GLUE,
G_UNICODE_BREAK_CONTINGENT,
G_UNICODE_BREAK_SPACE,
G_UNICODE_BREAK_AFTER,
G_UNICODE_BREAK_BEFORE,
G_UNICODE_BREAK_BEFORE_AND_AFTER,
G_UNICODE_BREAK_HYPHEN,
G_UNICODE_BREAK_NON_STARTER,
G_UNICODE_BREAK_OPEN_PUNCTUATION,
G_UNICODE_BREAK_CLOSE_PUNCTUATION,
G_UNICODE_BREAK_QUOTATION,
G_UNICODE_BREAK_EXCLAMATION,
G_UNICODE_BREAK_IDEOGRAPHIC,
G_UNICODE_BREAK_NUMERIC,
G_UNICODE_BREAK_INFIX_SEPARATOR,
G_UNICODE_BREAK_SYMBOL,
G_UNICODE_BREAK_ALPHABETIC,
G_UNICODE_BREAK_PREFIX,
G_UNICODE_BREAK_POSTFIX,
G_UNICODE_BREAK_COMPLEX_CONTEXT,
G_UNICODE_BREAK_AMBIGUOUS,
G_UNICODE_BREAK_UNKNOWN,
G_UNICODE_BREAK_NEXT_LINE,
G_UNICODE_BREAK_WORD_JOINER,
G_UNICODE_BREAK_HANGUL_L_JAMO,
G_UNICODE_BREAK_HANGUL_V_JAMO,
G_UNICODE_BREAK_HANGUL_T_JAMO,
G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
} GUnicodeBreakType;
typedef enum
{ /* ISO 15924 code */
G_UNICODE_SCRIPT_INVALID_CODE = -1,
G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */
G_UNICODE_SCRIPT_INHERITED, /* Qaai */
G_UNICODE_SCRIPT_ARABIC, /* Arab */
G_UNICODE_SCRIPT_ARMENIAN, /* Armn */
G_UNICODE_SCRIPT_BENGALI, /* Beng */
G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */
G_UNICODE_SCRIPT_CHEROKEE, /* Cher */
G_UNICODE_SCRIPT_COPTIC, /* Qaac */
G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
G_UNICODE_SCRIPT_DESERET, /* Dsrt */
G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */
G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */
G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
G_UNICODE_SCRIPT_GOTHIC, /* Goth */
G_UNICODE_SCRIPT_GREEK, /* Grek */
G_UNICODE_SCRIPT_GUJARATI, /* Gujr */
G_UNICODE_SCRIPT_GURMUKHI, /* Guru */
G_UNICODE_SCRIPT_HAN, /* Hani */
G_UNICODE_SCRIPT_HANGUL, /* Hang */
G_UNICODE_SCRIPT_HEBREW, /* Hebr */
G_UNICODE_SCRIPT_HIRAGANA, /* Hira */
G_UNICODE_SCRIPT_KANNADA, /* Knda */
G_UNICODE_SCRIPT_KATAKANA, /* Kana */
G_UNICODE_SCRIPT_KHMER, /* Khmr */
G_UNICODE_SCRIPT_LAO, /* Laoo */
G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */
G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */
G_UNICODE_SCRIPT_MYANMAR, /* Mymr */
G_UNICODE_SCRIPT_OGHAM, /* Ogam */
G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */
G_UNICODE_SCRIPT_ORIYA, /* Orya */
G_UNICODE_SCRIPT_RUNIC, /* Runr */
G_UNICODE_SCRIPT_SINHALA, /* Sinh */
G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
G_UNICODE_SCRIPT_TAMIL, /* Taml */
G_UNICODE_SCRIPT_TELUGU, /* Telu */
G_UNICODE_SCRIPT_THAANA, /* Thaa */
G_UNICODE_SCRIPT_THAI, /* Thai */
G_UNICODE_SCRIPT_TIBETAN, /* Tibt */
G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
G_UNICODE_SCRIPT_YI, /* Yiii */
G_UNICODE_SCRIPT_TAGALOG, /* Tglg */
G_UNICODE_SCRIPT_HANUNOO, /* Hano */
G_UNICODE_SCRIPT_BUHID, /* Buhd */
G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */
/* Unicode-4.0 additions */
G_UNICODE_SCRIPT_BRAILLE, /* Brai */
G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */
G_UNICODE_SCRIPT_LIMBU, /* Limb */
G_UNICODE_SCRIPT_OSMANYA, /* Osma */
G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */
G_UNICODE_SCRIPT_LINEAR_B, /* Linb */
G_UNICODE_SCRIPT_TAI_LE, /* Tale */
G_UNICODE_SCRIPT_UGARITIC, /* Ugar */
/* Unicode-4.1 additions */
G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */
G_UNICODE_SCRIPT_BUGINESE, /* Bugi */
G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */
G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */
G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */
G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */
/* Unicode-5.0 additions */
G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */
G_UNICODE_SCRIPT_BALINESE, /* Bali */
G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */
G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */
G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */
G_UNICODE_SCRIPT_NKO /* Nkoo */
} GUnicodeScript;
#endif /* __G_UNICODE_H__ */
+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
+373 -314
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
};
+41 -34
View File
@@ -154,7 +154,7 @@ static void clear_glyph_tree (QPF_GLYPHTREE* tree)
free (tree->more);
}
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;
uchar* data;
@@ -164,14 +164,14 @@ static void* load_font_data (const char* font_name, const char* file_name)
qpf_info = (QPFINFO*) calloc (1, sizeof(QPFINFO));
if (!(fp = fopen (file_name, "rb"))) {
_MG_PRINTF ("FONT>QPF: open file error: %s.\n",
_WRN_PRINTF ("FONT>QPF: open file error: %s.\n",
file_name);
goto error;
}
file_size = get_opened_file_size (fp);
if (file_size == 0) {
_MG_PRINTF ("FONT>QPF: empty font file: %s.\n",
_WRN_PRINTF ("FONT>QPF: empty font file: %s.\n",
file_name);
goto error;
}
@@ -180,14 +180,14 @@ static void* load_font_data (const char* font_name, const char* file_name)
if ((qpf_info->height
= fontGetHeightFromName (font_name)) == -1) {
_MG_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n",
_WRN_PRINTF ("FONT>QPF: Invalid font name (height): %s.\n",
font_name);
goto error;
}
if ((qpf_info->width
= fontGetWidthFromName (font_name)) == -1) {
_MG_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n",
_WRN_PRINTF ("FONT>QPF: Invalid font name (width): %s.\n",
font_name);
goto error;
}
@@ -222,7 +222,7 @@ error:
return NULL;
}
static void unload_font_data (void* data)
static void unload_font_data (DEVFONT* devfont, void* data)
{
QPFINFO* qpf_info = (QPFINFO*)data;
@@ -275,7 +275,7 @@ static unsigned char def_smooth_bitmap [] =
static QPF_GLYPH def_glyph = {&def_metrics, def_bitmap};
static QPF_GLYPH def_smooth_glyph = {&def_smooth_metrics, def_smooth_bitmap};
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH)
return DEVFONTGLYPHTYPE_GREYBMP;
@@ -302,7 +302,7 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
* 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 = QPFONT_INFO_P (devfont)->fm->ascent +
QPFONT_INFO_P (devfont)->fm->descent;
@@ -311,7 +311,8 @@ 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;
}
@@ -329,12 +330,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)
{
unsigned int uc16;
QPF_GLYPH* glyph;
if(devfont->charset_ops->conv_to_uc32)
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
uc16 = glyph_value;
@@ -342,10 +344,10 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
if (glyph == NULL) {
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
unsigned char ascii_ch = uc16;
return logfont->sbc_devfont->font_ops->get_glyph_monobitmap (logfont,
logfont->sbc_devfont, ascii_ch, pitch, scale);
return logfont->devfonts[0]->font_ops->get_glyph_monobitmap (logfont,
logfont->devfonts[0], ascii_ch, sz, pitch, scale);
}
else
glyph = &def_glyph;
@@ -365,11 +367,12 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
}
static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
Glyph32 glyph_value, int* pitch, unsigned short* scale)
Glyph32 glyph_value, SIZE* sz, int* pitch, unsigned short* scale)
{
unsigned int uc16;
QPF_GLYPH* glyph;
glyph_value = REAL_GLYPH(glyph_value);
if (scale)
*scale = GET_DEVFONT_SCALE (logfont, devfont);
@@ -400,6 +403,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
QPF_GLYPH* glyph;
unsigned short scale = GET_DEVFONT_SCALE (logfont, devfont);
glyph_value = REAL_GLYPH(glyph_value);
if(devfont->charset_ops->conv_to_uc32)
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
@@ -408,21 +412,21 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
if (glyph == NULL) {
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
unsigned char ascii_ch = uc16;
if (logfont->sbc_devfont->font_ops->get_glyph_bbox) {
return logfont->sbc_devfont->font_ops->get_glyph_bbox (logfont,
logfont->sbc_devfont, ascii_ch,
if (logfont->devfonts[0]->font_ops->get_glyph_bbox) {
return logfont->devfonts[0]->font_ops->get_glyph_bbox (logfont,
logfont->devfonts[0], ascii_ch,
px, py, pwidth, pheight);
}
else {
int width, height, ascent;
logfont->sbc_devfont->font_ops->get_glyph_advance
(logfont, logfont->sbc_devfont, glyph_value, &width, 0);
height = logfont->sbc_devfont->font_ops->get_font_height
(logfont, logfont->sbc_devfont);
ascent = logfont->sbc_devfont->font_ops->get_font_ascent
(logfont, logfont->sbc_devfont);
logfont->devfonts[0]->font_ops->get_glyph_advance
(logfont, logfont->devfonts[0], glyph_value, &width, 0);
height = logfont->devfonts[0]->font_ops->get_font_height
(logfont, logfont->devfonts[0]);
ascent = logfont->devfonts[0]->font_ops->get_font_ascent
(logfont, logfont->devfonts[0]);
if (pwidth) *pwidth = width;
if (pheight) *pheight = height;
@@ -452,6 +456,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
QPF_GLYPH* glyph;
int advance;
glyph_value = REAL_GLYPH(glyph_value);
if(devfont->charset_ops->conv_to_uc32)
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
@@ -460,11 +465,11 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
if (glyph == NULL) {
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
unsigned char ascii_ch = uc16;
if (logfont->sbc_devfont->font_ops->get_glyph_advance) {
return logfont->sbc_devfont->font_ops->
get_glyph_advance (logfont, logfont->sbc_devfont,
if (logfont->devfonts[0]->font_ops->get_glyph_advance) {
return logfont->devfonts[0]->font_ops->
get_glyph_advance (logfont, logfont->devfonts[0],
ascii_ch, px, py);
}
}
@@ -473,7 +478,8 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
}
advance = glyph->metrics->advance * GET_DEVFONT_SCALE (logfont, devfont);
*px += advance;
if (px)
*px += advance;
return advance;
}
@@ -498,6 +504,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
unsigned int uc16;
QPF_GLYPH* glyph;
glyph_value = REAL_GLYPH(glyph_value);
if(devfont->charset_ops->conv_to_uc32)
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
else
@@ -506,9 +513,9 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
if (glyph == NULL) {
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) /* ASCII */
return logfont->sbc_devfont->font_ops->is_glyph_existed (logfont,
logfont->sbc_devfont, glyph_value);
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) /* ASCII */
return logfont->devfonts[0]->font_ops->is_glyph_existed (logfont,
logfont->devfonts[0], glyph_value);
else
return FALSE;
}
@@ -522,7 +529,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/
FONTOPS __mg_qpf_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
+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,
+255
View File
@@ -0,0 +1,255 @@
/*
* script-language-table.inc:
* copied from LGPL'd Pango
*/
typedef struct _ScriptTypeForLang {
const char lang[7];
ScriptType scripts[3];
} ScriptTypeForLang;
static const ScriptTypeForLang _script_for_lang[] = {
{ "aa", { SCRIPT_LATIN/*62*/ } },
{ "ab", { SCRIPT_CYRILLIC/*90*/ } },
{ "af", { SCRIPT_LATIN/*69*/ } },
{ "ak", { SCRIPT_LATIN/*70*/ } },
{ "am", { SCRIPT_ETHIOPIC/*264*/ } },
{ "an", { SCRIPT_LATIN/*66*/ } },
{ "ar", { SCRIPT_ARABIC/*36*/ } },
{ "as", { SCRIPT_BENGALI/*64*/ } },
{ "ast", { SCRIPT_LATIN/*70*/ } },
{ "av", { SCRIPT_CYRILLIC/*67*/ } },
{ "ay", { SCRIPT_LATIN/*60*/ } },
{ "az-az", { SCRIPT_LATIN/*66*/ } },
{ "az-ir", { SCRIPT_ARABIC/*38*/ } },
{ "ba", { SCRIPT_CYRILLIC/*82*/ } },
{ "be", { SCRIPT_CYRILLIC/*68*/ } },
{ "ber-dz", { SCRIPT_LATIN/*70*/ } },
{ "ber-ma", { SCRIPT_TIFINAGH/*32*/ } },
{ "bg", { SCRIPT_CYRILLIC/*60*/ } },
{ "bh", { SCRIPT_DEVANAGARI/*68*/ } },
{ "bho", { SCRIPT_DEVANAGARI/*68*/ } },
{ "bi", { SCRIPT_LATIN/*58*/ } },
{ "bin", { SCRIPT_LATIN/*76*/ } },
{ "bm", { SCRIPT_LATIN/*60*/ } },
{ "bn", { SCRIPT_BENGALI/*63*/ } },
{ "bo", { SCRIPT_TIBETAN/*95*/ } },
{ "br", { SCRIPT_LATIN/*64*/ } },
{ "brx", { SCRIPT_DEVANAGARI/*78*/ } },
{ "bs", { SCRIPT_LATIN/*62*/ } },
{ "bua", { SCRIPT_CYRILLIC/*70*/ } },
{ "byn", { SCRIPT_ETHIOPIC/*255*/ } },
{ "ca", { SCRIPT_LATIN/*74*/ } },
{ "ce", { SCRIPT_CYRILLIC/*67*/ } },
{ "ch", { SCRIPT_LATIN/*58*/ } },
{ "chm", { SCRIPT_CYRILLIC/*76*/ } },
{ "chr", { SCRIPT_CHEROKEE/*85*/ } },
{ "co", { SCRIPT_LATIN/*84*/ } },
{ "crh", { SCRIPT_LATIN/*68*/ } },
{ "cs", { SCRIPT_LATIN/*82*/ } },
{ "csb", { SCRIPT_LATIN/*74*/ } },
{ "cu", { SCRIPT_CYRILLIC/*103*/ } },
{ "cv", { SCRIPT_CYRILLIC/*72*/, SCRIPT_LATIN/*2*/ } },
{ "cy", { SCRIPT_LATIN/*78*/ } },
{ "da", { SCRIPT_LATIN/*70*/ } },
{ "de", { SCRIPT_LATIN/*59*/ } },
{ "doi", { SCRIPT_DEVANAGARI/*81*/ } },
{ "dv", { SCRIPT_THAANA/*49*/ } },
{ "dz", { SCRIPT_TIBETAN/*95*/ } },
{ "ee", { SCRIPT_LATIN/*96*/ } },
{ "el", { SCRIPT_GREEK/*69*/ } },
{ "en", { SCRIPT_LATIN/*72*/ } },
{ "eo", { SCRIPT_LATIN/*64*/ } },
{ "es", { SCRIPT_LATIN/*66*/ } },
{ "et", { SCRIPT_LATIN/*64*/ } },
{ "eu", { SCRIPT_LATIN/*56*/ } },
{ "fa", { SCRIPT_ARABIC/*38*/ } },
{ "fat", { SCRIPT_LATIN/*70*/ } },
{ "ff", { SCRIPT_LATIN/*62*/ } },
{ "fi", { SCRIPT_LATIN/*62*/ } },
{ "fil", { SCRIPT_LATIN/*84*/ } },
{ "fj", { SCRIPT_LATIN/*52*/ } },
{ "fo", { SCRIPT_LATIN/*68*/ } },
{ "fr", { SCRIPT_LATIN/*84*/ } },
{ "fur", { SCRIPT_LATIN/*66*/ } },
{ "fy", { SCRIPT_LATIN/*75*/ } },
{ "ga", { SCRIPT_LATIN/*80*/ } },
{ "gd", { SCRIPT_LATIN/*70*/ } },
{ "gez", { SCRIPT_ETHIOPIC/*218*/ } },
{ "gl", { SCRIPT_LATIN/*66*/ } },
{ "gn", { SCRIPT_LATIN/*70*/ } },
{ "gu", { SCRIPT_GUJARATI/*68*/ } },
{ "gv", { SCRIPT_LATIN/*54*/ } },
{ "ha", { SCRIPT_LATIN/*60*/ } },
{ "haw", { SCRIPT_LATIN/*62*/ } },
{ "he", { SCRIPT_HEBREW/*27*/ } },
{ "hi", { SCRIPT_DEVANAGARI/*68*/ } },
{ "hne", { SCRIPT_DEVANAGARI/*68*/ } },
{ "ho", { SCRIPT_LATIN/*52*/ } },
{ "hr", { SCRIPT_LATIN/*62*/ } },
{ "hsb", { SCRIPT_LATIN/*72*/ } },
{ "ht", { SCRIPT_LATIN/*56*/ } },
{ "hu", { SCRIPT_LATIN/*70*/ } },
{ "hy", { SCRIPT_ARMENIAN/*77*/ } },
{ "hz", { SCRIPT_LATIN/*56*/ } },
{ "ia", { SCRIPT_LATIN/*52*/ } },
{ "id", { SCRIPT_LATIN/*54*/ } },
{ "ie", { SCRIPT_LATIN/*52*/ } },
{ "ig", { SCRIPT_LATIN/*58*/ } },
{ "ii", { SCRIPT_YI/*1165*/ } },
{ "ik", { SCRIPT_CYRILLIC/*68*/ } },
{ "io", { SCRIPT_LATIN/*52*/ } },
{ "is", { SCRIPT_LATIN/*70*/ } },
{ "it", { SCRIPT_LATIN/*72*/ } },
{ "iu", { SCRIPT_CANADIAN_ABORIGINAL/*161*/ } },
{ "ja", { SCRIPT_HAN/*2134*/, SCRIPT_KATAKANA/*88*/, SCRIPT_HIRAGANA/*85*/ } },
{ "jv", { SCRIPT_LATIN/*56*/ } },
{ "ka", { SCRIPT_GEORGIAN/*33*/ } },
{ "kaa", { SCRIPT_CYRILLIC/*78*/ } },
{ "kab", { SCRIPT_LATIN/*70*/ } },
{ "ki", { SCRIPT_LATIN/*56*/ } },
{ "kj", { SCRIPT_LATIN/*52*/ } },
{ "kk", { SCRIPT_CYRILLIC/*77*/ } },
{ "kl", { SCRIPT_LATIN/*81*/ } },
{ "km", { SCRIPT_KHMER/*63*/ } },
{ "kn", { SCRIPT_KANNADA/*70*/ } },
{ "ko", { SCRIPT_HANGUL/*2442*/ } },
{ "kok", { SCRIPT_DEVANAGARI/*68*/ } },
{ "kr", { SCRIPT_LATIN/*56*/ } },
{ "ks", { SCRIPT_ARABIC/*33*/ } },
{ "ku-am", { SCRIPT_CYRILLIC/*64*/ } },
{ "ku-iq", { SCRIPT_ARABIC/*32*/ } },
{ "ku-ir", { SCRIPT_ARABIC/*32*/ } },
{ "ku-tr", { SCRIPT_LATIN/*62*/ } },
{ "kum", { SCRIPT_CYRILLIC/*66*/ } },
{ "kv", { SCRIPT_CYRILLIC/*70*/ } },
{ "kw", { SCRIPT_LATIN/*64*/ } },
{ "kwm", { SCRIPT_LATIN/*52*/ } },
{ "ky", { SCRIPT_CYRILLIC/*70*/ } },
{ "la", { SCRIPT_LATIN/*68*/ } },
{ "lah", { SCRIPT_ARABIC/*27*/ } },
{ "lb", { SCRIPT_LATIN/*75*/ } },
{ "lez", { SCRIPT_CYRILLIC/*67*/ } },
{ "lg", { SCRIPT_LATIN/*54*/ } },
{ "li", { SCRIPT_LATIN/*62*/ } },
{ "ln", { SCRIPT_LATIN/*78*/ } },
{ "lo", { SCRIPT_LAO/*55*/ } },
{ "lt", { SCRIPT_LATIN/*70*/ } },
{ "lv", { SCRIPT_LATIN/*78*/ } },
{ "mai", { SCRIPT_DEVANAGARI/*68*/ } },
{ "mg", { SCRIPT_LATIN/*56*/ } },
{ "mh", { SCRIPT_LATIN/*62*/ } },
{ "mi", { SCRIPT_LATIN/*64*/ } },
{ "mk", { SCRIPT_CYRILLIC/*42*/ } },
{ "ml", { SCRIPT_MALAYALAM/*68*/ } },
{ "mn-cn", { SCRIPT_MONGOLIAN/*130*/ } },
{ "mn-mn", { SCRIPT_CYRILLIC/*70*/ } },
{ "mni", { SCRIPT_BENGALI/*75*/ } },
{ "mo", { SCRIPT_CYRILLIC/*66*/, SCRIPT_LATIN/*62*/ } },
{ "mr", { SCRIPT_DEVANAGARI/*68*/ } },
{ "ms", { SCRIPT_LATIN/*52*/ } },
{ "mt", { SCRIPT_LATIN/*72*/ } },
{ "my", { SCRIPT_MYANMAR/*48*/ } },
{ "na", { SCRIPT_LATIN/*60*/ } },
{ "nb", { SCRIPT_LATIN/*70*/ } },
{ "nds", { SCRIPT_LATIN/*59*/ } },
{ "ne", { SCRIPT_DEVANAGARI/*70*/ } },
{ "ng", { SCRIPT_LATIN/*52*/ } },
{ "nl", { SCRIPT_LATIN/*82*/ } },
{ "nn", { SCRIPT_LATIN/*76*/ } },
{ "no", { SCRIPT_LATIN/*70*/ } },
{ "nqo", { SCRIPT_NKO/*59*/ } },
{ "nr", { SCRIPT_LATIN/*52*/ } },
{ "nso", { SCRIPT_LATIN/*58*/ } },
{ "nv", { SCRIPT_LATIN/*70*/ } },
{ "ny", { SCRIPT_LATIN/*54*/ } },
{ "oc", { SCRIPT_LATIN/*70*/ } },
{ "om", { SCRIPT_LATIN/*52*/ } },
{ "or", { SCRIPT_ORIYA/*68*/ } },
{ "os", { SCRIPT_CYRILLIC/*66*/ } },
{ "ota", { SCRIPT_ARABIC/*37*/ } },
{ "pa", { SCRIPT_GURMUKHI/*63*/ } },
{ "pa-pk", { SCRIPT_ARABIC/*27*/ } },
{ "pap-an", { SCRIPT_LATIN/*72*/ } },
{ "pap-aw", { SCRIPT_LATIN/*54*/ } },
{ "pl", { SCRIPT_LATIN/*70*/ } },
{ "ps-af", { SCRIPT_ARABIC/*49*/ } },
{ "ps-pk", { SCRIPT_ARABIC/*49*/ } },
{ "pt", { SCRIPT_LATIN/*82*/ } },
{ "qu", { SCRIPT_LATIN/*54*/ } },
{ "quz", { SCRIPT_LATIN/*54*/ } },
{ "rm", { SCRIPT_LATIN/*66*/ } },
{ "rn", { SCRIPT_LATIN/*52*/ } },
{ "ro", { SCRIPT_LATIN/*62*/ } },
{ "ru", { SCRIPT_CYRILLIC/*66*/ } },
{ "rw", { SCRIPT_LATIN/*52*/ } },
{ "sa", { SCRIPT_DEVANAGARI/*68*/ } },
{ "sah", { SCRIPT_CYRILLIC/*76*/ } },
{ "sat", { SCRIPT_DEVANAGARI/*68*/ } },
{ "sc", { SCRIPT_LATIN/*62*/ } },
{ "sco", { SCRIPT_LATIN/*56*/ } },
{ "sd", { SCRIPT_ARABIC/*54*/ } },
{ "se", { SCRIPT_LATIN/*66*/ } },
{ "sel", { SCRIPT_CYRILLIC/*66*/ } },
{ "sg", { SCRIPT_LATIN/*72*/ } },
{ "sh", { SCRIPT_CYRILLIC/*94*/, SCRIPT_LATIN/*62*/ } },
{ "shs", { SCRIPT_LATIN/*46*/ } },
{ "si", { SCRIPT_SINHALA/*73*/ } },
{ "sid", { SCRIPT_ETHIOPIC/*281*/ } },
{ "sk", { SCRIPT_LATIN/*86*/ } },
{ "sl", { SCRIPT_LATIN/*62*/ } },
{ "sm", { SCRIPT_LATIN/*52*/ } },
{ "sma", { SCRIPT_LATIN/*60*/ } },
{ "smj", { SCRIPT_LATIN/*60*/ } },
{ "smn", { SCRIPT_LATIN/*68*/ } },
{ "sms", { SCRIPT_LATIN/*80*/ } },
{ "sn", { SCRIPT_LATIN/*52*/ } },
{ "so", { SCRIPT_LATIN/*52*/ } },
{ "sq", { SCRIPT_LATIN/*56*/ } },
{ "sr", { SCRIPT_CYRILLIC/*60*/ } },
{ "ss", { SCRIPT_LATIN/*52*/ } },
{ "st", { SCRIPT_LATIN/*52*/ } },
{ "su", { SCRIPT_LATIN/*54*/ } },
{ "sv", { SCRIPT_LATIN/*68*/ } },
{ "sw", { SCRIPT_LATIN/*52*/ } },
{ "syr", { SCRIPT_SYRIAC/*45*/ } },
{ "ta", { SCRIPT_TAMIL/*48*/ } },
{ "te", { SCRIPT_TELUGU/*70*/ } },
{ "tg", { SCRIPT_CYRILLIC/*78*/ } },
{ "th", { SCRIPT_THAI/*73*/ } },
{ "ti-er", { SCRIPT_ETHIOPIC/*255*/ } },
{ "ti-et", { SCRIPT_ETHIOPIC/*281*/ } },
{ "tig", { SCRIPT_ETHIOPIC/*221*/ } },
{ "tk", { SCRIPT_LATIN/*68*/ } },
{ "tl", { SCRIPT_LATIN/*84*/ } },
{ "tn", { SCRIPT_LATIN/*58*/ } },
{ "to", { SCRIPT_LATIN/*52*/ } },
{ "tr", { SCRIPT_LATIN/*70*/ } },
{ "ts", { SCRIPT_LATIN/*52*/ } },
{ "tt", { SCRIPT_CYRILLIC/*76*/ } },
{ "tw", { SCRIPT_LATIN/*70*/ } },
{ "ty", { SCRIPT_LATIN/*64*/ } },
{ "tyv", { SCRIPT_CYRILLIC/*70*/ } },
{ "ug", { SCRIPT_ARABIC/*33*/ } },
{ "uk", { SCRIPT_CYRILLIC/*72*/ } },
{ "ur", { SCRIPT_ARABIC/*27*/ } },
{ "uz", { SCRIPT_LATIN/*52*/ } },
{ "ve", { SCRIPT_LATIN/*62*/ } },
{ "vi", { SCRIPT_LATIN/*186*/ } },
{ "vo", { SCRIPT_LATIN/*54*/ } },
{ "vot", { SCRIPT_LATIN/*62*/ } },
{ "wa", { SCRIPT_LATIN/*70*/ } },
{ "wal", { SCRIPT_ETHIOPIC/*281*/ } },
{ "wen", { SCRIPT_LATIN/*76*/ } },
{ "wo", { SCRIPT_LATIN/*66*/ } },
{ "xh", { SCRIPT_LATIN/*52*/ } },
{ "yap", { SCRIPT_LATIN/*58*/ } },
{ "yi", { SCRIPT_HEBREW/*27*/ } },
{ "yo", { SCRIPT_LATIN/*114*/ } },
{ "za", { SCRIPT_LATIN/*52*/ } },
{ "zh-cn", { SCRIPT_HAN/*6763*/ } },
{ "zh-hk", { SCRIPT_HAN/*1083*/ } },
{ "zh-mo", { SCRIPT_HAN/*1083*/ } },
{ "zh-sg", { SCRIPT_HAN/*6763*/ } },
{ "zh-tw", { SCRIPT_HAN/*13063*/ } },
{ "zu", { SCRIPT_LATIN/*52*/ } }
};
+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,

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