Compare commits

..
Author SHA1 Message Date
Vincent Wei b4b18828b2 change GLYPHTYPE_ to CHARTYPE_ 2019-03-05 18:44:39 +08:00
Vincent Wei 36167be7e6 Tune APIs of Achar32 2019-03-05 18:18:54 +08:00
Vincent Wei 4b633c801d Introduce the Mchar32 type, and distinguish glyph and character 2019-03-05 12:27:35 +08:00
Vincent Wei 33fd8a8668 tune TTF cache arguments 2019-03-05 10:50:25 +08:00
Vincent Wei 94f44890a5 tune code to handle auto-italic correctly 2019-03-05 10:42:16 +08:00
Vincent Wei cc7441c4dd add df_slot to get_font_size of DEVFONT operators in order to set scale correctly 2019-03-05 09:16:36 +08:00
Vincent Wei 6fdc0281ba handle whitespace gracefully 2019-03-04 18:08:36 +08:00
Vincent Wei 136a51d9b8 cleanup 2019-03-04 16:47:19 +08:00
Vincent Wei 5e871c486b Tune FS_SLANT_XXX and tune auto bold implementation 2019-03-04 16:30:25 +08:00
Vincent Wei fdd69bf470 fix bug: do not override bitmap size for grey and subpixel glyph 2019-03-04 16:30:17 +08:00
Vincent Wei 10e55b0d4f restore style for TTF cache 2019-03-04 14:37:59 +08:00
Vincent Wei 682c81d636 tune 2019-03-04 11:52:47 +08:00
Vincent Wei 9eb4e54b75 cleanup 2019-03-04 11:39:32 +08:00
Vincent Wei e43bc07a63 tune fontcache functions: use devfont name instead of family and style 2019-03-04 11:37:50 +08:00
Vincent Wei 508130afdc tune 2019-03-03 20:06:07 +08:00
Vincent Wei d60c057dc4 tune load_flags 2019-03-03 20:00:54 +08:00
Vincent Wei 8f5a741af6 tune load_flags 2019-03-03 19:58:29 +08:00
Vincent Wei bee1bc87c4 tune code for size_request of LOGFONT 2019-03-03 19:14:18 +08:00
Vincent Wei 3a9274e9a0 add SIZE* sz for get_glyph_monobmp and get_glyph_graybmp 2019-03-03 18:54:39 +08:00
Vincent Wei 44ee735cd6 fix a bug of is_glyph_exsited (always returns FALSE) 2019-03-03 18:54:14 +08:00
Vincent Wei 2c010cdbeb fix a bug of fontDoesMatchFamily 2019-03-03 16:51:49 +08:00
Vincent Wei a04ae43bdb fix bug of gdiCreateLogFont 2019-03-03 16:43:40 +08:00
Vincent Wei 5c333445c5 tune font styles 2019-03-01 20:01:30 +08:00
Vincent Wei dd93e67a3d tune document 2019-03-01 14:38:48 +08:00
Vincent Wei d886268eee cleanup and check the duplicated fontname of a new devfont 2019-03-01 14:20:46 +08:00
Vincent Wei 090824cb91 bugfix 2019-02-28 19:08:05 +08:00
Vincent Wei 00eb4e363f Enhance LOGFONT to support multiple MBC devfonts (up to 7) 2019-02-28 18:47:44 +08:00
Vincent Wei f73f0786ee remove break_classes argument and add uchars argument for GetGlyphsAndBreaks 2019-02-28 11:50:00 +08:00
Vincent Wei dacc81cf2a Rename UCharGetBreak to UCharGetBreakType; Cleanup and optimization 2019-02-28 09:47:25 +08:00
Vincent Wei 97c6249af5 cleanup: remove definition of DEBUG 2019-02-27 18:47:25 +08:00
Vincent Wei 7ce1fe47ff implementation of character transformation of GetGlyphsAndBreaks; fix a bug of UCharToFullSizeKana 2019-02-27 18:33:32 +08:00
Vincent Wei 8e66bb366e tune word breaks and sentence breaks 2019-02-27 17:56:41 +08:00
Vincent Wei ce7fd6e776 passed all test cases for UAX#14 and UAX#29 2019-02-27 11:37:17 +08:00
Vincent Wei 957f9cbb47 remove break_classes argument from GetGlyphsExtentPointEx 2019-02-26 19:07:37 +08:00
Vincent Wei 2a7e3003bd Rename GetGlyphsByRules to GetGlyphsAndBreaks 2019-02-26 18:47:33 +08:00
Vincent Wei 19cd208a6e support for GB, WB, SB in break_oppos; add emoji tables 2019-02-26 17:59:50 +08:00
Vincent Wei 6a44111a35 cleanup 2019-02-25 17:09:37 +08:00
Vincent Wei fd5d55942b use Uint16 type for break_oppo instead of Uint8 type in order to contain GB, WB, SB flags 2019-02-25 16:42:49 +08:00
Vincent Wei d4e7f048f0 fixbug 2019-02-25 09:12:51 +08:00
Vincent Wei d90c4d5842 cleanup 2019-02-24 18:31:38 +08:00
Vincent Wei 0f562cd39f cleanup 2019-02-24 15:02:16 +08:00
Vincent Wei fb01003c45 use LEN_VBF_NAME instead of LEN_DEVFONT_NAME 2019-02-24 14:56:43 +08:00
Vincent Wei 9bcea02975 cleanup 2019-02-24 13:35:43 +08:00
Vincent Wei c51ae8d1c1 cleanup 2019-02-22 19:11:37 +08:00
Vincent Wei b8a5ad2d73 return NULL when not matched devfont 2019-02-22 19:11:26 +08:00
Vincent Wei 39b8c88d1b new DC attribute: DC_ATTR_WORD_EXTRA 2019-02-22 18:46:23 +08:00
Vincent Wei 1e73f6713a enable cache of freetype2 engine for rotated glyphs 2019-02-22 17:51:41 +08:00
Vincent Wei 97babaa4e2 add size_request in LOGFONT for original requested size 2019-02-22 17:46:13 +08:00
Vincent Wei c6c486f306 almost there 2019-02-22 15:47:20 +08:00
Vincent Wei 338f10b896 debug 2019-02-22 12:39:07 +08:00
Vincent Wei 2353a873a8 debug GetGlyphsExtentPointEx 2019-02-22 10:49:02 +08:00
Vincent Wei 52c539e870 debug 2019-02-21 20:21:02 +08:00
Vincent Wei 64d63a84c5 cleanup and bugfixs 2019-02-21 18:43:14 +08:00
Vincent Wei 3d80d73450 cleanup and bugfixs 2019-02-21 18:38:49 +08:00
Vincent Wei 2e04898fbe fix bugs 2019-02-21 15:56:51 +08:00
Vincent Wei f390e1a091 fix bugs 2019-02-21 15:51:11 +08:00
Vincent Wei 848c1d7ce1 tune 2019-02-21 12:07:02 +08:00
Vincent Wei 0c0becc780 tune 2019-02-21 10:32:16 +08:00
Vincent Wei 0e918da2a4 bugfix: get_ch_width does not check glyph value 2019-02-21 10:32:01 +08:00
Vincent Wei 7f36c339b7 tune 2019-02-20 18:21:17 +08:00
Vincent Wei 871486daab cleanup 2019-02-20 16:41:21 +08:00
Vincent Wei 0cffc8798f Suppress and/or hang spaces and punctations for GetGlyphsExtentPointEx 2019-02-20 16:00:16 +08:00
Vincent Wei 4d4a3901eb TODOs 2019-02-19 18:53:20 +08:00
Vincent Wei 50e95cb461 Initial implementation of GetGlyphsExtentPointEx and DrawGlyphStringEx 2019-02-19 18:38:57 +08:00
Vincent Wei d223edf0ba partial implementation of GetGlyphsExtentPointEx 2019-02-19 17:48:39 +08:00
Vincent Wei 8e88082f07 UCharGetType -> UCharGetCategory 2019-02-19 10:45:49 +08:00
Vincent Wei 5b1762b637 Enhance GetGlyphsByRules to return breaking classes 2019-02-19 09:41:22 +08:00
Vincent Wei 6c83ea4ceb implementation for LBP_NORMAL and LBP_STRICT; both passed all test cases 2019-02-18 18:24:59 +08:00
Vincent Wei 5aa5e75813 UCharBasicType -> UCharGeneralCategory 2019-02-18 12:16:49 +08:00
Vincent Wei 1ba35dcbf6 implementation of WBR_BREAK_ALL and WBR_KEEP_ALL 2019-02-18 11:44:54 +08:00
Vincent Wei 8828824b23 Add BOV_NOTALLOWED_DEFINITELY and BOV_NOTALLOWED_UNCERTAINLY 2019-02-18 09:25:18 +08:00
Vincent Wei e3f2cc22ec tune BIDILogGlyphs2VisGlyphsEx and BIDILogGlyphs2VisGlyphs 2019-02-17 12:56:35 +08:00
Vincent Wei 93aae6782e Tune GetGlyphsByRules and GetGlyphsExtentPointEx 2019-02-17 11:53:35 +08:00
Vincent Wei b746d2927e Partial implementation of GetGlyphsExtentPointEx 2019-02-15 18:07:03 +08:00
Vincent Wei 79e3be705c simplify the interfaces of GetGlyphsExtentPointEx and DrawGlyphStringEx 2019-02-15 11:07:54 +08:00
Vincent Wei a052b7bf55 cleanup BIDI APIs 2019-02-14 19:45:50 +08:00
Vincent Wei 74a84362ca correct some bad names of BIDI-related APIs 2019-02-14 17:27:11 +08:00
Vincent Wei d673008f5a tune API description 2019-02-14 11:52:59 +08:00
Vincent Wei 09c9438de8 tune api description 2019-01-29 17:02:48 +08:00
Vincent Wei 0734180d70 set user_comp_ctxt to be pixel format for default composition operators 2019-01-29 15:43:23 +08:00
Vincent Wei 8ca8deb02d list developers 2019-01-29 10:51:15 +08:00
Vincent Wei 9aa719aeb3 list developers 2019-01-29 10:42:43 +08:00
Vincent Wei 447eebbafc all UNICODE LINE BREAKING ALGORITHM test cases for GetGlyphsByRules passed 2019-01-27 12:45:20 +08:00
Vincent Wei 19f8689a20 almost passed the test cases for GetGlyphsByRules 2019-01-25 21:34:34 +08:00
Vincent Wei 60902f83d5 debug GetGlyphsByRules 2019-01-25 20:42:32 +08:00
Vincent Wei a725acfd5e debug GetGlyphsByRules 2019-01-25 16:14:42 +08:00
Vincent Wei 0191772111 Tune the implementation of UNICODE LINE BREAKING ALGORITHM 2019-01-24 20:17:27 +08:00
Vincent Wei a11cef5f2e push 2019-01-24 18:43:30 +08:00
Vincent Wei cf4c75bcbc almost finished GetGlyphsByRules 2019-01-24 11:31:54 +08:00
Vincent Wei f85801dcbe part implementation of GetGlyphsByRules 2019-01-23 17:08:03 +08:00
Vincent Wei 4e67f8c56b part implementation of GetGlyphsByRules 2019-01-23 14:36:56 +08:00
Vincent Wei 1cfd2fe324 part implementation of GetGlyphsByRules 2019-01-22 10:50:15 +08:00
Vincent Wei 5ef2e0fa42 temp 2019-01-21 17:14:59 +08:00
Vincent Wei 57b71e985c Add UCharGetType, UCharGetBreak, UCharGetBIDIType, and UCharGetMirror for completeness 2019-01-21 16:19:20 +08:00
Vincent Wei d9d76ec59b DrawGlyphStringEx returns BOOL 2019-01-19 18:29:09 +08:00
Vincent Wei 7935883267 GetGlyphsByRules returns line break opportunities 2019-01-19 18:20:55 +08:00
Vincent Wei 0385def7b2 tune 2019-01-19 15:05:53 +08:00
Vincent Wei 565f4b34e5 cleanup 2019-01-19 15:02:55 +08:00
Vincent Wei 70ba8a0420 cleanup 2019-01-19 14:59:12 +08:00
Vincent Wei 4bdbe4a002 tune 2019-01-19 14:53:35 +08:00
Vincent Wei 2c98ef96da tune release notes 2019-01-19 14:24:26 +08:00
Vincent Wei 6663c98787 add CreateLogFontIndirectEx function 2019-01-19 14:21:46 +08:00
Vincent Wei bbf2376f7a fix a potential bug: reserve key when creating logfont by calling CreateLogFontIndirect 2019-01-19 14:04:11 +08:00
Vincent Wei 21ac9f2def add content language and writing system parameters for rendering glyphs for CSS 2019-01-19 13:27:01 +08:00
Vincent Wei a10d28dd11 unicode script and language code 2019-01-19 12:57:34 +08:00
Vincent Wei 856126c72e make GRF_HANGING_PUNC_FIRST and GRF_HANGING_PUNC_LAST as flag bits 2019-01-18 18:07:44 +08:00
Vincent Wei 547fc0059c tune readme 2019-01-18 16:45:23 +08:00
Vincent Wei 195363dc82 use the same table for UCharToFullSizeKana and UCharToSmallKana 2019-01-18 16:24:56 +08:00
Vincent Wei 54288e5687 more API description 2019-01-18 16:15:14 +08:00
Vincent Wei 9d46406a95 some API description 2019-01-18 15:49:10 +08:00
Vincent Wei d365feca5d tune 2019-01-18 14:05:19 +08:00
Vincent Wei f34ac9d0fe UChar32 -> Uchar32; UChar16 -> Uchar16 2019-01-18 13:56:18 +08:00
Vincent Wei 3a02b056ca Tune format 2019-01-18 12:39:23 +08:00
Vincent Wei 1a1e8cf652 Add UCharToFullWidth and UCharToFullSizeKana 2019-01-18 12:37:53 +08:00
Vincent Wei 94feb0ae44 Tune Glyph32 and UChar32 to be unsigned 2019-01-18 11:43:42 +08:00
Vincent Wei 1e1a5edd13 tune 2019-01-18 11:29:35 +08:00
Vincent Wei ae9b14201b make sure the strings are null-terminated (fontDoesMatchFamily) 2019-01-18 09:29:39 +08:00
Vincent Wei 742150d4f1 restore LEN_FONT_NAME 2019-01-17 19:29:14 +08:00
Vincent Wei 03eac03c8c add UCharCanonicalOrdering and others for composition and decomposition 2019-01-17 18:45:22 +08:00
Vincent Wei 8cd6b037ec tuen release notes 2019-01-17 14:59:40 +08:00
Vincent Wei b35e38bdff tune length of devfont name fields; devfont now supports family aliases 2019-01-17 14:55:06 +08:00
Vincent Wei 58275c88e9 call REAL_GLYPH for devfont operators 2019-01-17 12:40:25 +08:00
Vincent Wei 31b43521d0 call REAL_GLYPH for charset operators 2019-01-17 12:14:02 +08:00
Vincent Wei e68ee00b85 rename glyph type macros and glyph type now includes MCHAR_TYPE_XXX for ASCII characters 2019-01-17 11:59:29 +08:00
Vincent Wei 6e54d4a7d7 add macro GLYPH2UCHAR 2019-01-16 20:43:01 +08:00
Vincent Wei 69b1d63569 Rename IsGlyphAlnum, GlyphToUpper to IsUCharAlnum, UCharToTitle and so on 2019-01-16 20:37:56 +08:00
Vincent Wei 817f4063a1 Add UNICODE utilities: IsGlyphAlnum, GlyphToUpper, ... 2019-01-16 20:34:51 +08:00
Vincent Wei c9ec23dc70 empty implementation of glyphs APIs for CSS 2019-01-16 19:27:41 +08:00
Vincent Wei 972085fa56 cleanup 2019-01-16 17:50:21 +08:00
Vincent Wei c2e24b61e3 cleanup 2019-01-16 17:44:48 +08:00
Vincent Wei bd1fb67930 retrive the break type of UNICODE char; upgrade UNICODE tables to 10.0.0 2019-01-16 17:10:50 +08:00
Vincent Wei 0fcedfca08 cleanup 2019-01-16 14:52:12 +08:00
Vincent Wei c39ce7c0b8 cleanup 2019-01-16 12:04:43 +08:00
Vincent Wei 97014ccdc8 cleanup 2019-01-16 12:02:58 +08:00
Vincent Wei 48e7f6e928 cleanup 2019-01-16 11:53:46 +08:00
Vincent Wei 473f9f98ff cleanup 2019-01-16 11:52:56 +08:00
Vincent Wei 95d09a7673 tune and cleanup 2019-01-16 11:43:27 +08:00
Vincent Wei 53253ed101 optimize the font matching algorithm 2019-01-16 10:18:26 +08:00
Vincent Wei 4bd7c0eef4 add mutex for freetype2 font engine (MGRM_THREADS) and remove lock/unlock of __mg_gdi_lock in _font_get_glyph_advance 2019-01-16 10:06:46 +08:00
Vincent Wei 9af71438dd cleanup 2019-01-15 17:02:11 +08:00
Vincent Wei 747894247b tune release notes 2019-01-15 16:18:45 +08:00
Vincent Wei 82033a44dd cleanup and fix the bug of wrong bboxing handling for SUBPIXEL rendering of glyph 2019-01-15 14:50:46 +08:00
Vincent Wei 1c9537fc63 BMP_TYPE_REPLACEKEY for BITMAP; Declaration of GetGlyphsExtentPointEx and DrawGlyphStringEx; cleanup of GLYPHINFO and GLYPHBITMAP 2019-01-15 10:17:25 +08:00
Vincent Wei 612c395c06 Backward compatiblity of CreateLogFont 2019-01-14 10:23:37 +08:00
Vincent Wei 8dc0ee2ade cleanup 2019-01-13 18:56:41 +08:00
Vincent Wei caefd7355a cleanup 2019-01-13 18:36:03 +08:00
Vincent Wei 9ea0e15dba try to match devfont without style 2019-01-13 17:42:27 +08:00
Vincent Wei 83c8984c74 support flipping glyph for subpixel rendering 2019-01-13 16:59:36 +08:00
Vincent Wei 4761333a1a skip null pixels for subpixel 2019-01-13 16:20:08 +08:00
Vincent Wei 8538f29f70 fixbug: No need to make the pitch of FT2 monobitmap is single-byte aligned 2019-01-13 14:21:18 +08:00
Vincent Wei b658413961 cleanup 2019-01-13 13:17:23 +08:00
Vincent Wei bb187f1ee3 cleanup font name and glyph renderer 2019-01-13 13:10:13 +08:00
Vincent Wei ea8ab93bad cleanup 2019-01-12 15:02:56 +08:00
Vincent Wei 9226fcff26 add examples/createlogfontex.c and cleanup examples/createlogfont.c 2019-01-12 14:03:52 +08:00
Vincent Wei 05cf370155 Cleanup LOGFONT styles 2019-01-12 13:55:51 +08:00
Vincent Wei 0d2352884a tune style for LOGFONT 2019-01-11 10:55:55 +08:00
102 changed files with 82523 additions and 19419 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
+140 -6
View File
@@ -1,12 +1,146 @@
# Release Notes
## Version 3.2.2
## Version 3.4.0
The MiniGUI development team announces the availability of MiniGUI 3.2.2.
The MiniGUI development team announces the availability of MiniGUI 3.4.0.
All users of MiniGUI are recommended strongly to use this version.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui.
https://github.com/VincentWei/minigui
### What's new in this version
In this version, we mainly enhanced and tuned the APIs of font rendering.
#### Tunning the logical font APIs
The styles of LOGFONT changed.
* Add new rendering style:
1. `FS_RENDER_ANY`: Not specified
1. `FS_RENDER_MONO`:
1. `FS_RENDER_GREY`:
1. `FS_RENDER_SUBPIXEL`:
* Some old styles are deprecated:
1. `FS_WEIGHT_BOOK`; use `FS_RENDER_GREY` instead.
1. `FS_WEIGHT_SUBPIXEL`; use `FS_RENDER_SUBPIXEL` instead.
* Introduced or redefined the weight styles to follow OpenType specification:
1. `FONT_WEIGHT_ANY`: Not specified
1. `FONT_WEIGHT_THIN`: Thin.
1. `FONT_WEIGHT_EXTRA_LIGHT`: Extra light (Ultra Light).
1. `FONT_WEIGHT_LIGHT`: Light.
1. `FONT_WEIGHT_REGULAR`: Regular (Normal).
1. `FONT_WEIGHT_MEDIUM`: Medium.
1. `FONT_WEIGHT_DEMIBOLD`: Demi Bold (Semi Bold)
1. `FONT_WEIGHT_BOLD`: Bold.
1. `FONT_WEIGHT_EXTRA_BOLD`: Extra Bold (Ultra Bold).
1. `FONT_WEIGHT_BLACK`: Black (Heavy).
* Introduce the new decoration styles and replace
`FONT_UNDERLINE_LINE` and `FONT_STRUCKOUT_LINE` with them:
1. `FONT_DECORATE_ANY`: Not specified.
1. `FONT_DECORATE_NONE`: None.
1. `FONT_DECORATE_UNDERLINE`: glyphs are underscored.
1. `FONT_DECORATE_STRUCKOUT`: glyphs are overstruck.
1. `FONT_DECORATE_US`: Both `FONT_DECORATE_UNDERLINE` and `FONT_DECORATE_STRUCKOUT`.
1. `FONT_DECORATE_OUTLINE`: Outline (hollow) glyphs.
1. `FONT_DECORATE_REVERSE`: Reverved for future. Glyphs have their foreground and background reversed.
* The following style are deprecated:
1. `FONT_OTHER_LCDPORTRAIT`
1. `FONT_OTHER_LCDPORTRAITKERN`
For a new app, you should use the new function `CreateLogFontEx` to
create a LOGFONT, and specify the weight and rendering method of the glyph.
For the back-compatibility, you can still use `CreateLogFont` to create a new
LOGFONT. However, `FS_WEIGHT_BOOK` will be treated `FS_WEIGHT_REGULAR` and
`FS_RENDER_GREY`, while `FS_WEIGHT_SUBPIXEL` will be treated
`FS_WEIGHT_REGULAR` and `FS_RENDER_SUBPIXEL`.
You can still use `CreateLogFontByName` to create a new LOGFONT.
But the style string in the font name changed from
<weight><slant><flipping><other><underline><struckout>
to
<weight><slant><flipping><other><decoration><rendering>
Note that `<underline>` and `<struckout>` are merged to `<decoration>`
in order to keep the style string is still 6-character long.
Consequently, if you want to use the rendering method SUPIXEL for a TTF font,
please define the logical font name in the following way:
ttf-Courier-rrncns-*-16-UTF-8
Moreover, the family name of a DEVFONT supports aliases since 3.4.0:
<fonttype>-<family[,aliase]*>-<styles>-<width>-<height>-<charset[,charset]*>
for example:
ttf-Arial,Sans Serif-rrncnn-8-16-ISO8859-1,UTF-8
ttf-courier,monospace,serif-rrncnn-8-16-ISO8859-1,UTF-8
Note that the length of one DEVFONT name can not exceed 255 bytes.
#### Changed APIs
* The fields `height` and `descent` have been removed from GLYPHINFO struct.
One should get the font metrics information by calling `GetFontMetrics` function
if you want to get the height and descent data of one font.
* More fields added for GLYPHBITMAP struct in order to return the completed
rasterized glyph bitmap information.
* `GetGlyphInfo` now can return the basic glyph type and break type of a
UNICODE character. If the glyph is an ASCII character, the old `MCHAR_TYPE`
can also be returned.
* Rename `mg_FT_LcdFilter` to `FT2LCDFilter` in order to follow MiniGUI naming
rules.
* Rename `UChar32` to `Uchar32` and `UChar16` to `Uchar16` in order to
avoid the conflict with typedef of UChar32 in 'unicode/umachine.h'.
* Redefine `Uchar32` and `Glyph32` as `Uint32` instead of `int`.
#### New APIs
* `GetGlyphsByRules` function calculates and allocates the glyph string from
a multi-byte string under the specified white space rule and transformation
rule.
* `GetGlyphsExtentPointEx` function gets the visual extent information
of a glyph string which can fit in a line with the specified maximal extent.
* `DrawGlyphStringEx` function draws a glyph string to the specific
positions of a DC.
* `CreateLogFontIndirectEx` creates a new LOGFONT by using the value of
an existed LOGFONT but with a new rotation value.
#### Others
* Support for FreeType1 removed.
You should always use FreeType2 to support vector fonts, such as TrueType
fonts (TTF), TrueType collections (TTC), OpenType fonts (OTF, both TrueType
and CFF variants), OpenType collections (OTC), and Type 1 fonts (PFA and PFB).
### Other Changes
* A new BITMAP type: `BMP_TYPE_REPLACEKEY`. When `bmType` of a BITMAP object
has this bit set, any pixel which is equal to `bmColorKey` will be replaced by
`bmColorRep`.
## Version 3.2.1
The MiniGUI development team announces the availability of MiniGUI 3.2.1.
All users of MiniGUI are recommended strongly to use this version.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui
### What's new in this version
@@ -24,8 +158,8 @@ 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 DC attribute: BIDI flag.
@@ -58,7 +192,7 @@ The MiniGUI development team announces the availability of MiniGUI 3.2.0.
All users of MiniGUI are recommended strongly to use this version for new
MiniGUI apps. Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui.
https://github.com/VincentWei/minigui
### What's new in this version
+3 -3
View File
@@ -1,9 +1,9 @@
Version 3.2.0 (2018/02/10)
Version 3.4.0 (2019/06/30)
This release needs the following resource packages:
* minigui-res-3.0.13.tar.gz
* minigui-res-3.4.0.tar.gz
The latest samples package is:
* mg-samples-3.2.0.tar.gz
* mg-samples-3.4.0.tar.gz
+36 -25
View File
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(libminigui, 3.2.2)
AC_INIT(libminigui, 3.4.0)
AC_CONFIG_SRCDIR(src/main/main.c)
dnl Set various version strings - taken gratefully from the SDL sources
@@ -15,10 +15,10 @@ dnl Set various version strings - taken gratefully from the SDL sources
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
#
MINIGUI_MAJOR_VERSION=3
MINIGUI_MINOR_VERSION=2
MINIGUI_MICRO_VERSION=2
MINIGUI_MINOR_VERSION=4
MINIGUI_MICRO_VERSION=0
MINIGUI_INTERFACE_AGE=0
MINIGUI_BINARY_AGE=1
MINIGUI_BINARY_AGE=0
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
AC_SUBST(MINIGUI_MAJOR_VERSION)
@@ -537,7 +537,7 @@ AC_ARG_ENABLE(sefsupport,
build_sef_support=$enableval)
AC_ARG_WITH(ttfsupport,
[ --with-ttfsupport=ft1/ft2/none How to support TrueType font (FreeType 1/FreeType 2/None) <default=none>],
[ --with-ttfsupport=ft2/none How to support TrueType font (FreeType 2 or None) <default=ft2>],
use_ttf_lib=$withval)
AC_ARG_ENABLE(ttfcache,
@@ -1978,17 +1978,20 @@ fi
dnl Check FreeType lib
case "$use_ttf_lib" in
ft2)
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")
;;
ft2)
dnl Check for FreeType2 library
AC_CHECK_LIB(freetype, FT_Library_Version,
DEP_LIBS="$DEP_LIBS -lfreetype",
use_ttf_lib="none")
*)
use_ttf_lib="none"
;;
esac
@@ -2000,7 +2003,7 @@ case "$use_ttf_lib" in
[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)
@@ -2023,30 +2026,38 @@ 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]])
[ --with-mttfcachenum=[16/32/64/128]])
case "$with_mttfcachenum" in
10)
AC_DEFINE(_MGMAX_TTF_CACHE, 10,
[Define if compile max ttf cahce number for 10])
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
+5 -5
View File
@@ -239,9 +239,9 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
496 static int euckr_is_this_charset (const unsigned char* charset)
497 {
498 int i;
499 char name [LEN_FONT_NAME + 1];
499 char name [LEN_LOGFONT_NAME_FIELD + 1];
500
501 for (i = 0; i &lt; LEN_FONT_NAME + 1; i++) {
501 for (i = 0; i &lt; LEN_LOGFONT_NAME_FIELD + 1; i++) {
502 if (charset [i] == '\0')
503 break;
504 name [i] = toupper (charset [i]);
@@ -388,9 +388,9 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
<table border="0" cellpadding="0" class="code-sample" width="100%"><tr><td> <pre>
228 typedef struct _LOGFONT {
229 char type [LEN_FONT_NAME + 1];
230 char family [LEN_FONT_NAME + 1];
231 char charset [LEN_FONT_NAME + 1];
229 char type [LEN_LOGFONT_NAME_FIELD + 1];
230 char family [LEN_LOGFONT_NAME_FIELD + 1];
231 char charset [LEN_LOGFONT_NAME_FIELD + 1];
232 DWORD style;
233 int size;
234 int rotation;
+12 -12
View File
@@ -1,14 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontbig24;
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
12, 0);
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
24, 0);
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
16, 0);
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
12, 0);
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
24, 0);
+14
View File
@@ -0,0 +1,14 @@
static LOGFONT *logfont, *logfontgb12, *logfontttf;
logfont = CreateLogFontEx (NULL, "SansSerif", "ISO8859-1",
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
16, 0);
logfontgb12 = CreateLogFontEx (NULL, "song", "GB2312",
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FONT_OTHER_NIL, FONT_DECORATE_NONE, FONT_RENDER_MONO,
12, 0);
logfontttf = CreateLogFontEx ("ttf", "Courier", "UTF-8",
FONT_WEIGHT_BLACK, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
FS_OTHER_LCDPORTRAIT, FONT_DECORATE_NONE, FONT_RENDER_SUBPIXEL,
24, 0);
+14
View File
@@ -694,6 +694,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.
+2935 -679
View File
File diff suppressed because it is too large Load Diff
+238 -240
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);
+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;
+11 -5
View File
@@ -1458,7 +1458,6 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rctop = rc.top;
if (mouseX <= right && mouseX >= left && (p != pData->pItemSelected) ) {
PLOGFONT logfont;
c = getCountFromItem (pData, pData->pItemSelected);
c = c - pData->nItemTop - 1;
if (c < 0)
@@ -1471,12 +1470,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rc.top += TV_BORDER;
rc.bottom = rc.top + pData->nItemHeight;
/*bugfix: 4864, zhaochengzhang*/
/* VincentWei: do not depend on logfont style
PLOGFONT logfont;
//bugfix: 4864, zhaochengzhang
logfont = GetWindowFont(hwnd);
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
rc.top = rctop + (count - pData->nItemTop - 1) * pData->nItemHeight;
@@ -1484,17 +1486,18 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
rc.top += TV_BORDER;
rc.bottom = rc.top + pData->nItemHeight;
/*bugfix: 4864 zhaochengzhang*/
/* VincentWei: do not depend on logfont style
//bugfix: 4864 zhaochengzhang
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
NotifyParent (hwnd, pData->id, TVN_CLICKED);
}
if (mouseX <= left + h && mouseX >= left) {
PLOGFONT logfont;
if (p->child == NULL)
break;
@@ -1519,12 +1522,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
tvSetHScrollInfo (hwnd, pData, TRUE);
rc.bottom = rcClient.bottom;
/*bugfix: 4864 zhaochengzhang*/
/* VincentWei: do not depend on the logfont style
PLOGFONT logfont;
//bugfix: 4864 zhaochengzhang
logfont = GetWindowFont(hwnd);
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
rc.left--; rc.top--;
rc.right++; rc.bottom++;
}
*/
InvalidateRect (hwnd, &rc, TRUE);
NotifyParent (hwnd, pData->id, TVN_CLICKED);
}
+10 -6
View File
@@ -3,21 +3,25 @@ SUBDIRS = in-core
noinst_LTLIBRARIES = libfont.la
SRC_FILES = charset.c charset-arabic.c charset-bidi.c \
unicode-comp.c unicode-script.c language-code.c \
sysfont.c logfont.c devfont.c fontname.c \
rawbitmap.c varbitmap.c qpf.c upf.c \
fontcache.c freetype1.c freetype2.c font-engines.c\
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
bitmapfont.c scripteasy.c \
unicode-emoji.c
HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype1.h freetype2.h qpf.h \
upf.h bitmapfont.h gunichartables.h se_minigui.h unicode-bidi-tables.h
HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype2.h qpf.h se_minigui.h \
upf.h bitmapfont.h unicode-bidi-tables.h \
unicode-tables.h unicode-break.h unicode-decomp.h unicode-comp.h unicode-emoji-table.h
EXTRA_DIST = convgbmap.c jisunimap.c $(SRC_FILES) $(HDR_FILES) \
makefile.ng makefile.msvc
AM_CPPFLAGS = $(FT1_INC_DIR) $(FT2_INC_DIR)
# AM_CPPFLAGS = $(FT1_INC_DIR) $(FT2_INC_DIR)
AM_CPPFLAGS = $(FT2_INC_DIR)
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
libfont_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
+18 -13
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;
}
@@ -365,7 +368,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
/**************************** Global data ************************************/
FONTOPS __mg_bitmap_font_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
@@ -408,7 +411,6 @@ build_bmpfont_info (const char *bmpfont_name, const BITMAP* glyph_bmp,
goto error_load;
}
bmpfont_info->ave_width = glyph_width;
bmpfont_info->max_width = glyph_width;
bmpfont_info->node_cnt = 1;
@@ -441,6 +443,7 @@ error_load:
return NULL;
}
#if 0 // VincentWei: bad implementation
static int set_devfont_style (char* name, char style)
{
int i;
@@ -461,7 +464,7 @@ static int set_devfont_style (char* name, char style)
return 1;
}
#endif
/************************/
DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
@@ -469,7 +472,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
{
DEVFONT* bitmapfont_dev_font = NULL;
CHARSETOPS* charset_ops;
char charset[LEN_FONT_NAME + 1];
char charset[LEN_LOGFONT_NAME_FIELD + 1];
BMPFONTINFO *bmpfont_info;
int offset;
@@ -484,7 +487,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
goto error_create;
}
offset = (charset_ops->char_glyph_value) (NULL, 0,
offset = (charset_ops->get_char_value) (NULL, 0,
(const unsigned char*) start_mchar, 0);
bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp,
@@ -500,15 +503,17 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
return NULL;
}
/*
* Set device name and add BOLD & ITALIC style
*/
strncpy (bitmapfont_dev_font->name ,bmpfont_name, LEN_UNIDEVFONT_NAME);
/*
* Set device name
*/
strncpy (bitmapfont_dev_font->name, bmpfont_name, LEN_UNIDEVFONT_NAME);
#if 0 // VincentWei: bad implementation
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_WEIGHT_BOLD))
return NULL;
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_SLANT_ITALIC))
return NULL;
#endif
bitmapfont_dev_font->name [LEN_UNIDEVFONT_NAME] = '\0';
bitmapfont_dev_font->style = fontConvertStyle (bitmapfont_dev_font->name);
@@ -545,7 +550,7 @@ BOOL AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
return FALSE;
/* Insert a node in the avl tree */
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
(const unsigned char*)start_mchar, 0);
if (look_up (root, offset) == NULL) {
@@ -639,7 +644,7 @@ static int avl_look_up (DEVFONT *dev_font, char *start_mchar, int n)
GLYPHTREENODE *p;
int offset;
offset = (*dev_font->charset_ops->char_glyph_value) (NULL, 0,
offset = (*dev_font->charset_ops->get_char_value) (NULL, 0,
(const unsigned char*)start_mchar, n);
offset += n;
File diff suppressed because it is too large Load Diff
+116 -93
View File
File diff suppressed because it is too large Load Diff
+915 -349
View File
File diff suppressed because it is too large Load Diff
+229 -82
View File
File diff suppressed because it is too large Load Diff
+42 -59
View File
File diff suppressed because it is too large Load Diff
+186 -30
View File
File diff suppressed because it is too large Load Diff
+21 -12
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;
@@ -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,
+353 -220
View File
File diff suppressed because it is too large Load Diff
+23 -19
View File
@@ -40,6 +40,14 @@
#ifndef GUI_FREETYP2_H
#define GUI_FREETYP2_H
#undef TTF_DBG
#ifndef TTF_DBG
#define DP(x)
#else
#define DP(x) do { printf x; } while (0)
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -54,6 +62,7 @@ extern "C" {
#include FT_CACHE_MANAGER_H
#include FT_TRIGONOMETRY_H
#include FT_IMAGE_H
#include FT_TRUETYPE_TABLES_H
#if 0
#define _MGFONT_TTF_CACHE 1
@@ -62,14 +71,13 @@ extern "C" {
#endif
#ifdef _MGFONT_TTF_CACHE
typedef unsigned long HCACHE;
typedef int (* MakeHashKeyFunc)(unsigned short unicode);
typedef void* HCACHE;
typedef int (* MakeHashKeyFunc)(Uchar32 unicode);
#endif
typedef struct tagFTFACEINFO {
#ifdef _MGFONT_TTF_CACHE
/*should be MAX_PATH*/
char filepathname[256];
char* filepathname;
int face_index;
int cmap_index;
#else
@@ -114,38 +122,34 @@ typedef struct tagFTINSTANCEINFO {
#define _TTF_HASH_NDIR 37
typedef struct tagTTFCACHEINFO {
unsigned short unicode;
short glyph_code;
Uchar32 unicode;
FT_UInt glyph_code;
FT_Vector advance;
FT_BBox bbox;
FT_Vector delta;
int flag;
int pitch;
int width;
int height;
void *bitmap;
} TTFCACHEINFO, *PTTFCACHEINFO;
extern HCACHE __mg_ttc_create(char *family, char *charset, DWORD style, int size,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
extern HCACHE __mg_ttc_create(const char *df_name,
int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
extern HCACHE __mg_ttc_is_exist(const char *df_name,
int style, int size, int rotation);
extern int __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size);
extern void __mg_ttc_release(HCACHE hCache);
extern int __mg_ttc_sys_init(int maxCache, int cacheSize);
extern void __mg_ttc_sys_deinit(void);
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache,
unsigned short unicode, int *size);
extern HCACHE __mg_ttc_is_exist(char *family, char *charset,
DWORD style, int size);
Uchar32 unicode, int *size);
extern void __mg_ttc_refer(HCACHE hCache);
#endif
#undef TTF_DBG
#ifndef TTF_DBG
#define DP(x)
#else
#define DP(x) do { printf x; } while (0)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
File diff suppressed because it is too large Load Diff
-201
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+373 -312
View File
File diff suppressed because it is too large Load Diff
+41 -32
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;
@@ -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);
}
}
@@ -482,9 +487,12 @@ static DEVFONT* new_instance (LOGFONT* logfont, DEVFONT* devfont,
BOOL need_sbc_font)
{
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH) {
logfont->style &= ~FS_WEIGHT_SUBPIXEL;
logfont->style |= FS_WEIGHT_BOOK;
logfont->style &= ~FS_WEIGHT_LIGHT;
logfont->style &= ~FS_RENDER_MASK;
logfont->style |= FS_RENDER_GREY;
}
else {
logfont->style &= ~FS_RENDER_MASK;
logfont->style |= FS_RENDER_MONO;
}
return devfont;
@@ -495,6 +503,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
@@ -503,9 +512,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;
}
@@ -519,7 +528,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,
+13 -15
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,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;
}
@@ -208,13 +205,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 +221,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
@@ -268,7 +266,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,
+11 -5
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
@@ -534,6 +538,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
SeLogFont selogfont;
int x = *px;
glyph_value = REAL_GLYPH(glyph_value);
if (devfont->charset_ops->conv_to_uc32)
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
else
@@ -558,6 +563,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 +583,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/
static FONTOPS scripteasy_font_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
+12 -12
View File
@@ -102,10 +102,10 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
char type [LEN_FONT_NAME + 1];
char family [LEN_FONT_NAME + 1];
char style [LEN_FONT_NAME + 1];
char charset [LEN_FONT_NAME + 1];
char type [LEN_LOGFONT_NAME_FIELD + 1];
char family [LEN_LOGFONT_FAMILY_FILED + 1];
char style [LEN_LOGFONT_NAME_FIELD + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
char font_name [LEN_DEVFONT_NAME + 1];
int height;
int j = 0, need = 0;
@@ -205,28 +205,28 @@ void mg_TermSysFont (void)
const char* GUIAPI GetSysCharset (BOOL wchar)
{
if (wchar) {
if (g_SysLogFont[1]->mbc_devfont)
return MBC_DEVFONT_INFO_P (g_SysLogFont[1])->charset_ops->name;
if (g_SysLogFont[1]->devfonts[1])
return g_SysLogFont[1]->devfonts[1]->charset_ops->name;
else
return NULL;
}
else
return SBC_DEVFONT_INFO_P (g_SysLogFont[0])->charset_ops->name;
return g_SysLogFont[0]->devfonts[0]->charset_ops->name;
}
int GUIAPI GetSysCharWidth (void)
{
DEVFONT* sbc_devfont = g_SysLogFont[0]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[0]->devfonts[0];
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[0], sbc_devfont);
}
int GUIAPI GetSysCCharWidth (void)
{
DEVFONT* mbc_devfont = g_SysLogFont[1]->mbc_devfont;
DEVFONT* mbc_devfont = g_SysLogFont[1]->devfonts[1];
if (mbc_devfont)
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
else
return GetSysCharWidth () * 2;
}
@@ -238,14 +238,14 @@ int GUIAPI GetSysCharHeight (void)
int GUIAPI GetSysFontMaxWidth (int font_id)
{
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
return sbc_devfont->font_ops->get_max_width (g_SysLogFont[font_id], sbc_devfont);
}
int GUIAPI GetSysFontAveWidth (int font_id)
{
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->sbc_devfont;
DEVFONT* sbc_devfont = g_SysLogFont[font_id]->devfonts[0];
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[font_id], sbc_devfont);
}
+1 -1
View File
@@ -86,7 +86,7 @@ BOOL mg_InitSysFont (void)
for (i = 0; i < nr_fonts; i++) {
char key [11];
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
char file [MAX_PATH + 1];
sprintf (key, "name%d", i);
+1 -2
View File
@@ -6,8 +6,7 @@ u:arabic_test_unicode
hex:arabic_test_hex
MINIGUI_COMMON = /usr/local/include/minigui
LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lttf
#LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lfreetype
LIBS = -lminigui_ths -lm -ljpeg -lz -lpng -lpthread -lfreetype
arabic_test:arabic_test.c $(MINIGUI_COMMON)
gcc arabic_test.c -Wall -g -o arabic_test $(LIBS)
+1 -1
View File
@@ -149,7 +149,7 @@ void read_total_file( void )
fclose (fp);
}
static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
static LRESULT HelloWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message) {
+2 -2
View File
@@ -101,10 +101,10 @@ static int test_correctness ()
if (index < 0) /* not a letter.*/
continue;
glyph_value = iso8859_6_char_glyph_value (NULL, 0, c, 1);
glyph_value = iso8859_6_get_char_value (NULL, 0, c, 1);
fprintf (stderr, "%x 's glyph value = %x\n", *c, glyph_value);
if (!test_glyph_value (index, glyph_value)) {
if (!iso8859_6_test_glyph_value (index, glyph_value)) {
fprintf (stderr, "Shape error: %x\n", *c);
return 0;
}
+3 -3
View File
@@ -6,13 +6,13 @@ helloworld:helloworld.c
gcc helloworld.c -Wall -g -o helloworld -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test:hebrew_test.c
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_release:hebrew_test.c
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_debug:hebrew_test.c
gcc hebrew_test.c -DARABIC_DEBUG -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lttf -lpng -lpthread
gcc hebrew_test.c -DARABIC_DEBUG -g -o hebrew_test -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
hebrew_test_unicode:hebrew_test.c
gcc hebrew_test.c -DARABIC_UNICODE -DARABIC_DEBUG -g -o hebrew_test_u -lminigui_ths -lm -lfreetype -ljpeg -lz -lpng -lpthread
+13 -13
View File
@@ -59,23 +59,23 @@ char filename[256];
char fontname[50];
BOOL textout = TRUE;
RECT arabic_rc = {0, 0, 640, 480};
RECT hebrew_rc = {0, 0, 640, 480};
int line_num = 0;
static char msg_text [256] = "Show text with TextOut.";
static FILE *fp = NULL;
static PLOGFONT logfont_iso8859_8;
//static char arabic_text[] = {0xc7,0xe4,0xe1,0xd1,0xea,0xe2,0xa0,0xc7,0xe4,0xca,0xe2,0xe6,0xea,0x00};
//static char hebrew_text[] = {0xc7,0xe4,0xe1,0xd1,0xea,0xe2,0xa0,0xc7,0xe4,0xca,0xe2,0xe6,0xea,0x00};
static int reset_fp_pos()
{
arabic_rc.left = 0;
arabic_rc.top = 0;
arabic_rc.right = g_rcScr.right - 24;
arabic_rc.bottom = g_rcScr.bottom;
hebrew_rc.left = 0;
hebrew_rc.top = 0;
hebrew_rc.right = g_rcScr.right - 24;
hebrew_rc.bottom = g_rcScr.bottom;
if(!fp){
DBGLOG2("============================= arabic_test %s===============================\n", filename);
DBGLOG2("============================= hebrew_test %s===============================\n", filename);
fp = fopen(filename, "rb");
if (!fp) {
DBGLOG2("cannot open %s\n", filename);
@@ -140,7 +140,7 @@ void read_total_file( void )
fclose (fp);
}
static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
static LRESULT HelloWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message) {
@@ -196,13 +196,13 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
if(textout == TRUE) {
if(GetTextAlign(hdc) == TA_RIGHT)
TextOut(hdc, arabic_rc.right, i*line_height, pline);
TextOut(hdc, hebrew_rc.right, i*line_height, pline);
else
TextOut(hdc, arabic_rc.left, i*line_height, pline);
TextOut(hdc, hebrew_rc.left, i*line_height, pline);
}
else{
int height = DrawText(hdc, pline, -1, &arabic_rc, DT_RIGHT);
arabic_rc.top += height;
int height = DrawText(hdc, pline, -1, &hebrew_rc, DT_RIGHT);
hebrew_rc.top += height;
}
i++;
}
@@ -210,7 +210,7 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
/*
else{
read_total_file();
DrawText(hdc, filebuf, -1, &arabic_rc, DT_RIGHT);
DrawText(hdc, filebuf, -1, &hebrew_rc, DT_RIGHT);
}
*/
#endif
View File
View File
View File
View File
View File
+39 -39
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -79,7 +79,7 @@ static encstruct default_enc;
#define CHARSPACEUNIT2PIXEL(x) (x/1000)
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)
{
int j;
int font_id;
@@ -109,7 +109,7 @@ error:
return NULL;
}
static void unload_font_data (void* data)
static void unload_font_data (DEVFONT* devfont, void* data)
{
free (data);
}
@@ -200,8 +200,11 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
return type1_inst_info->font_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, scale);
return expect;
}
+1 -1
View File
@@ -43,7 +43,7 @@
typedef struct _bidichar_type_map
{
Uint32 type; // Type of Unicode characters
Glyph32 glyph; // Starting index of Unicode character
Uchar32 chv; // Starting index of Unicode character
Uint8 count; // Total number of Unicode characters of same type starting from glyphn
} BIDICHAR_TYPE_MAP;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+107
View File
@@ -0,0 +1,107 @@
/*
* 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/>.
*/
/*
** Some operators to check Emoji.
** Implementation of the functions is based on some code from LGPL'd Pango.
**
** Created by WEI Yongming at 2019/02/26
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#ifdef _MGCHARSET_UNICODE
#include "unicode-ops.h"
#include "unicode-emoji-table.h"
static int interval_compare(const void *key, const void *elt)
{
Uchar32 c = (Uchar32)(intptr_t)key;
struct Interval *interval = (struct Interval *)elt;
if (c < interval->start)
return -1;
if (c > interval->end)
return +1;
return 0;
}
#define DEFINE_unicode_is_(name) \
BOOL _unicode_is_##name (Uchar32 ch) \
{ \
if (bsearch ((void*)((intptr_t)ch), \
_unicode_##name##_table, \
TABLESIZE (_unicode_##name##_table), \
sizeof _unicode_##name##_table[0], \
interval_compare)) \
return TRUE; \
\
return FALSE; \
}
DEFINE_unicode_is_(emoji)
DEFINE_unicode_is_(emoji_presentation)
DEFINE_unicode_is_(emoji_modifier)
DEFINE_unicode_is_(emoji_modifier_base)
DEFINE_unicode_is_(emoji_extended_pictographic)
BOOL _unicode_is_emoji_text_default(Uchar32 ch)
{
return _unicode_is_emoji(ch) && !_unicode_is_emoji_presentation(ch);
}
BOOL _unicode_is_emoji_emoji_default(Uchar32 ch)
{
return _unicode_is_emoji_presentation(ch);
}
BOOL _unicode_is_emoji_keycap_base(Uchar32 ch)
{
return (ch >= '0' && ch <= '9') || ch == '#' || ch == '*';
}
BOOL _unicode_is_regional_indicator(Uchar32 ch)
{
return (ch >= 0x1F1E6 && ch <= 0x1F1FF);
}
#endif /* _MGCHARSET_UNICODE */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+40 -42
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -40,9 +40,9 @@
#ifndef GUI_FONT_UPF_H
#define GUI_FONT_UPF_H
#define LEN_VERSION_MAX 10
#define LEN_VENDER_NAME_MAX 12
#define LEN_DEVFONT_NAME_MAX 127
#define LEN_VERSION_MAX 10
#define LEN_VENDER_NAME_MAX 12
#define LEN_UPF_NAME_MAX 127
#ifdef __cplusplus
extern "C" {
@@ -100,7 +100,7 @@ typedef struct
char vender_name [LEN_VENDER_NAME_MAX];
Uint16 endian;
char font_name [LEN_DEVFONT_NAME_MAX + 1];
char font_name [LEN_UPF_NAME_MAX + 1];
Uint8 width;
Uint8 height;
+6 -6
View File
@@ -197,13 +197,13 @@ static BOOL get_font_propt(FILE* fp, char* family, char* font_rrncnn, char* cha
/*FAMILY_NAME*/
if (strcmp (line_buf, "FAMILY_NAME") == 0)
{
if (strlen(body) > LEN_FONT_NAME)
if (strlen(body) > LEN_LOGFONT_NAME_FIELD)
{
fprintf(stderr, "the FAMILY_NAME is too long, "
"please truncation it to less than %d\n", LEN_FONT_NAME-2);
"please truncation it to less than %d\n", LEN_LOGFONT_NAME_FIELD-2);
return FALSE;
}
strncpy (family, body, LEN_FONT_NAME);
strncpy (family, body, LEN_LOGFONT_NAME_FIELD);
}
else if (strcmp (line_buf, "WEIGHT_NAME") == 0)
set_rrncnn (font_rrncnn, SET_WEIGHT_POS, body);
@@ -216,7 +216,7 @@ static BOOL get_font_propt(FILE* fp, char* family, char* font_rrncnn, char* cha
/*FIXME must inorder*/
else if (strcmp (line_buf, "CHARSET_REGISTRY") == 0)
strncpy (charset, body, LEN_FONT_NAME);
strncpy (charset, body, LEN_LOGFONT_NAME_FIELD);
else if (strcmp (line_buf, "CHARSET_ENCODING") == 0)
{
if (body[0] != '-')
@@ -494,8 +494,8 @@ typedef struct _FONT_PROPT {
} FONT_PROPT;
char font_name [LEN_UNIDEVFONT_NAME];
char family [LEN_FONT_NAME];
char charset [LEN_FONT_NAME];
char family [LEN_LOGFONT_NAME_FIELD];
char charset [LEN_LOGFONT_NAME_FIELD];
char new_file_name [LEN_UNIDEVFONT_NAME+5];
#define MAKE_HEADER(header, glyph_num)\
+3 -3
View File
@@ -54,7 +54,7 @@ typedef int BOOL;
#define TRUE 1
#define FALSE 0
#define LEN_FONT_NAME 23
#define LEN_LOGFONT_NAME_FIELD 23
#define LEN_DEVFONT_NAME 79
extern VBFINFO extern_vbfinfo;
@@ -64,8 +64,8 @@ extern VBFINFO extern_vbfinfo;
BOOL dumpVBF (VBFINFO* vbf, char* file)
{
FILE* fp;
char family [LEN_FONT_NAME + 1];
char style [LEN_FONT_NAME + 1];
char family [LEN_LOGFONT_NAME_FIELD + 1];
char style [LEN_LOGFONT_NAME_FIELD + 1];
int len_offsets;
int len_widths;
int len_header;
+70
View File
@@ -0,0 +1,70 @@
#!/usr/bin/python
from __future__ import print_function, division, absolute_import
import sys
import os.path
from collections import OrderedDict
if len (sys.argv) != 2:
print("usage: ./gen-emoji-table.py emoji-data.txt", file=sys.stderr)
sys.exit (1)
f = open(sys.argv[1])
header = [f.readline () for _ in range(10)]
ranges = OrderedDict()
for line in f.readlines():
line = line.strip()
if not line or line[0] == '#':
continue
rang, typ = [s.strip() for s in line.split('#')[0].split(';')[:2]]
rang = [int(s, 16) for s in rang.split('..')]
if len(rang) > 1:
start, end = rang
else:
start = end = rang[0]
if typ not in ranges:
ranges[typ] = []
if ranges[typ] and ranges[typ][-1][1] == start - 1:
ranges[typ][-1] = (ranges[typ][-1][0], end)
else:
ranges[typ].append((start, end))
print("/* == Start of generated table == */")
print("/*")
print(" * The following tables are generated by running:")
print(" *")
print(" * ./gen-emoji-table.py emoji-data.txt")
print(" *")
print(" * on file with this header:")
print(" *")
for l in header:
print(" * %s" % (l.strip()))
print(" */")
print()
print("#ifndef UNICODE_EMOJI_TABLE_H")
print("#define UNICODE_EMOJI_TABLE_H")
print()
print("struct Interval {\n Uchar32 start, end;\n};")
for typ,s in ranges.items():
if typ not in ['emoji',
'emoji_presentation',
'emoji_modifier',
'emoji_modifier_base',
'extended_pictographic']: continue
print()
print("static const struct Interval _unicode_%s_table[] =" % typ)
print("{")
for pair in sorted(s):
print(" {0x%04X, 0x%04X}," % pair)
print("};")
print()
print("#endif /* UNICODE_EMOJI_TABLE_H */")
print()
print("/* == End of generated table == */")
+1552
View File
File diff suppressed because it is too large Load Diff
+142
View File
@@ -0,0 +1,142 @@
aa Afar
ab Abkhazian
af Afrikaans
am Amharic
ar Arabic
as Assamese
ay Aymara
az Azerbaijani
ba Bashkir
be Byelorussian
bg Bulgarian
bh Bihari
bi Bislama
bn Bengali
bo Tibetan
br Breton
ca Catalan
co Corsican
cs Czech
cy Welch
da Danish
de German
dz Bhutani
el Greek
en English
eo Esperanto
es Spanish
et Estonian
eu Basque
fa Persian
fi Finnish
fj Fiji
fo Faeroese
fr French
fy Frisian
ga Irish
gd Scots Gaelic
gl Galician
gn Guarani
gu Gujarati
ha Hausa
hi Hindi
he Hebrew
hr Croatian
hu Hungarian
hy Armenian
ia Interlingua
id Indonesian
ie Interlingue
ik Inupiak
in former Indonesian
is Icelandic
it Italian
iu Inuktitut (Eskimo)
iw former Hebrew
ja Japanese
ji former Yiddish
jw Javanese
ka Georgian
kk Kazakh
kl Greenlandic
km Cambodian
kn Kannada
ko Korean
ks Kashmiri
ku Kurdish
ky Kirghiz
la Latin
ln Lingala
lo Laothian
lt Lithuanian
lv Latvian, Lettish
mg Malagasy
mi Maori
mk Macedonian
ml Malayalam
mn Mongolian
mo Moldavian
mr Marathi
ms Malay
mt Maltese
my Burmese
na Nauru
ne Nepali
nl Dutch
no Norwegian
oc Occitan
om (Afan) Oromo
or Oriya
pa Punjabi
pl Polish
ps Pashto, Pushto
pt Portuguese
qu Quechua
rm Rhaeto-Romance
rn Kirundi
ro Romanian
ru Russian
rw Kinyarwanda
sa Sanskrit
sd Sindhi
sg Sangro
sh Serbo-Croatian
si Singhalese
sk Slovak
sl Slovenian
sm Samoan
sn Shona
so Somali
sq Albanian
sr Serbian
ss Siswati
st Sesotho
su Sudanese
sv Swedish
sw Swahili
ta Tamil
te Tegulu
tg Tajik
th Thai
ti Tigrinya
tk Turkmen
tl Tagalog
tn Setswana
to Tonga
tr Turkish
ts Tsonga
tt Tatar
tw Twi
ug Uigur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
vo Volapuk
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
za Zhuang
zh Chinese
zu Zulu
File diff suppressed because it is too large Load Diff
+29 -19
View File
@@ -52,7 +52,7 @@
#include "misc.h"
#ifdef HAVE_MMAP
#include <sys/mman.h>
#include <sys/mman.h>
#endif
#include "devfont.h"
@@ -60,7 +60,8 @@
#include "charset.h"
#include "fontname.h"
#define HEADER_LEN 68
#define HEADER_LEN 68
#define LEN_VBF_NAME 79
#define VARFONT_INFO_P(devfont) ((VBFINFO*)(devfont->data))
#define VARFONT_INFO(devfont) ((VBFINFO*)(devfont.data))
@@ -85,7 +86,7 @@ typedef struct _FILE_LAYOUT {
} FILE_LAYOUT;
typedef struct _FONT_PROPT {
char font_name [LEN_DEVFONT_NAME + 1];
char font_name [LEN_VBF_NAME + 1];
char max_width;
char ave_width;
char height;
@@ -96,7 +97,7 @@ typedef struct _FONT_PROPT {
int def_glyph;
} FONT_PROPT;
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{
return DEVFONTGLYPHTYPE_MONOBMP;
}
@@ -111,6 +112,9 @@ static int get_ch_width (LOGFONT* logfont, DEVFONT* devfont,
if (vbf_info->bits_offset == NULL)
return vbf_info->max_width * scale;
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value < vbf_info->first_glyph || glyph_value > vbf_info->last_glyph)
glyph_value = vbf_info->def_glyph;
return vbf_info->advance_x [glyph_value - vbf_info->first_glyph] * scale;
}
@@ -129,7 +133,7 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
return VARFONT_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 = VARFONT_INFO_P (devfont)->height;
unsigned short scale = 1;
@@ -137,7 +141,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;
}
@@ -156,7 +161,6 @@ static int get_font_descent (LOGFONT* logfont, DEVFONT* devfont)
* GET_DEVFONT_SCALE (logfont, devfont);
}
static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
Glyph32 glyph_value,
int* px, int* py, int* pwidth, int* pheight)
@@ -165,7 +169,9 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
VBFINFO* vbf_info = VARFONT_INFO_P (devfont);
unsigned short scale = GET_DEVFONT_SCALE (logfont, devfont);
if (glyph_value < vbf_info->first_glyph || glyph_value > vbf_info->last_glyph)
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value < vbf_info->first_glyph
|| glyph_value > vbf_info->last_glyph)
glyph_value = vbf_info->def_glyph;
/*have bbox*/
@@ -173,7 +179,6 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
int offset;
offset = glyph_value - vbf_info->first_glyph;
if (px) {
tempint = vbf_info->bbox[offset].x;
#if MGUI_BYTEORDER == MGUI_BIG_ENDIAN
@@ -225,6 +230,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
int advance;
VBFINFO* vbf_info = VARFONT_INFO_P (devfont);
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value < vbf_info->first_glyph || glyph_value > vbf_info->last_glyph)
glyph_value = vbf_info->def_glyph;
@@ -234,10 +240,10 @@ static int get_glyph_advance (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 offset;
Glyph32 eff_value = glyph_value;
Glyph32 eff_value;
Glyph32 first_value;
Glyph32 last_value;
VBFINFO* vbf_info = VARFONT_INFO_P (devfont);
@@ -245,6 +251,8 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
first_value = vbf_info->first_glyph;
last_value = vbf_info->last_glyph;
glyph_value = REAL_GLYPH(glyph_value);
eff_value = glyph_value;
if (glyph_value < first_value || glyph_value > last_value)
eff_value = vbf_info->def_glyph;
@@ -302,6 +310,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
first_value = vbf_info->first_glyph;
last_value = vbf_info->last_glyph;
glyph_value = REAL_GLYPH(glyph_value);
if (glyph_value < first_value || glyph_value > last_value)
return FALSE;
else
@@ -327,7 +336,8 @@ static void swap_intdata (Uint32* data, int num)
}
#endif
static void* load_font_data (const char* fontname, const char* filename)
static void* load_font_data (DEVFONT* devfont, const char* fontname,
const char* filename)
{
FILE* fp = NULL;
@@ -358,15 +368,15 @@ static void* load_font_data (const char* fontname, const char* filename)
if (fread(vender, 1, VBF_LEN_VENDER_INFO, fp) < VBF_LEN_VENDER_INFO)
goto error;
if (fread(&len_header, sizeof(short), 1, fp) < 1)
if (fread(&len_header, sizeof(Uint16), 1, fp) < 1)
goto error;
if (fread (&layout, sizeof (FILE_LAYOUT), 1, fp) < 1)
if (fread(&layout, sizeof(Uint32), 11, fp) < 1)
goto error;
#if MGUI_BYTEORDER == MGUI_BIG_ENDIAN
len_header = ArchSwap16 (len_header);
swap_intdata ((Uint32*)&layout, sizeof(layout)/sizeof(int));
swap_intdata ((Uint32*)&layout, 11);
#endif
#ifdef HAVE_MMAP
@@ -420,8 +430,8 @@ static void* load_font_data (const char* fontname, const char* filename)
layout.off_bits-HEADER_LEN);
#if 0
if (real_fontname) {
strncpy (real_fontname, info->name, LEN_DEVFONT_NAME);
real_fontname [LEN_DEVFONT_NAME] = '\0';
strncpy (real_fontname, info->name, LEN_VBF_NAME);
real_fontname [LEN_VBF_NAME] = '\0';
}
#endif
@@ -441,7 +451,7 @@ error:
return NULL;
}
static void unload_font_data (void* data)
static void unload_font_data (DEVFONT* devfont, void* data)
{
VBFINFO* info = (VBFINFO*) data;
#ifdef HAVE_MMAP
@@ -456,7 +466,7 @@ static void unload_font_data (void* data)
}
FONTOPS __mg_vbf_ops = {
get_glyph_type,
get_glyph_bmptype,
get_ave_width,
get_max_width,
get_font_height,
+40 -28
View File
@@ -43,43 +43,55 @@
extern "C" {
#endif /* __cplusplus */
typedef struct _VBF_BBOX
{
typedef struct _VBF_BBOX {
char x, y, w, h;
} VBF_BBOX;
typedef struct
{
char ver_info [4]; /* font version*/
const char* name; /* font name*/
typedef struct {
/* font version*/
char ver_info [4];
/* font name*/
const char* name;
char max_width; /* The max width in pixels. */
char ave_width; /* The average width in pixels. */
char height; /* The height in pixels. */
char descent; /* The pixels below the base line. */
/* The max width in pixels. */
char max_width;
/* The average width in pixels. */
char ave_width;
/* The height in pixels. */
char height;
/* The pixels below the base line. */
char descent;
int first_glyph; /* The glyph number of the first character in this font.*/
int last_glyph; /* The glyph number of the last character in this font.*/
int def_glyph; /* The glyph number of the default character in this font.*/
/* The glyph number of the first character in this font.*/
int first_glyph;
/* The glyph number of the last character in this font.*/
int last_glyph;
/* The glyph number of the default character in this font.*/
int def_glyph;
unsigned int font_size; /* used by mmap. It should be zero for in-core vbfs. */
/* used by mmap. It should be zero for in-core vbfs. */
unsigned int font_size;
const VBF_BBOX* bbox; /* The pointer to the glyph bounding box array or NULL. */
/* The pointer to the glyph bounding box array or NULL. */
const VBF_BBOX* bbox;
const char* advance_x; /* The pointer to the glyph advance x array.
If bbox is NULL, the array contains the width of each glyph.
If advance_x is NULL, the glyph has the universal width,
that's max_width. */
const char* advance_y; /* The pointer to the glyph advance y array.
If bbox is NULL, advance_y should be NULL.
If bbox is not NULL and advance_y is NULL,
all glyph has the universal advance_y, that is, zero. */
/* The pointer to the glyph advance x array.
If bbox is NULL, the array contains the width of each glyph.
If advance_x is NULL, the glyph has the universal width,
that's max_width. */
const char* advance_x;
/* The pointer to the glyph advance y array.
If bbox is NULL, advance_y should be NULL.
If bbox is not NULL and advance_y is NULL,
all glyph has the universal advance_y, that is, zero. */
const char* advance_y;
const unsigned int* bits_offset; /* The pointer to the glyph bitmap offset array
whose number will be used to fetch glyph bitmap
from bits array or NULL. */
const unsigned char* all_glyph_bits; /* The 8-bit right-padded bitmap data for all glyphs. */
/* The pointer to the glyph bitmap offset array
whose number will be used to fetch glyph bitmap
from bits array or NULL. */
const unsigned int* bits_offset;
/* The 8-bit right-padded bitmap data for all glyphs. */
const unsigned char* all_glyph_bits;
} VBFINFO;
#define VBF_LEN_VERSION_INFO 10
+2 -2
View File
@@ -681,9 +681,9 @@ BOOL GUIAPI TranslateKeyMsgToChar (int message, WPARAM wParam, LPARAM lParam, WO
#ifdef _MGCHARSET_UNICODE
static UChar32 utf8_to_wc (const unsigned char* mstr, int* utf8_len)
static Uchar32 utf8_to_wc (const unsigned char* mstr, int* utf8_len)
{
UChar32 wc = *((unsigned char *)(mstr++));
Uchar32 wc = *((unsigned char *)(mstr++));
int n, t;
*utf8_len = 1;
+10 -10
View File
@@ -70,13 +70,13 @@
typedef struct _CHARSET
{
char name [LEN_FONT_NAME + 1];
char name [LEN_LOGFONT_NAME_FIELD + 1];
struct _CHARSET* next;
}CHARSET;
typedef struct _FAMILY
{
char name [LEN_FONT_NAME + 1];
char name [LEN_LOGFONT_NAME_FIELD + 1];
CHARSET chset_head;
struct _FAMILY* next;
}FAMILY;
@@ -98,8 +98,8 @@ static FAMILY* find_insert_family (FAMILY* head, const char* fami_name)
}
cur = (FAMILY*)malloc(sizeof(*cur));
strncpy (cur->name, fami_name, LEN_FONT_NAME);
cur->name [LEN_FONT_NAME] = '\0';
strncpy (cur->name, fami_name, LEN_LOGFONT_NAME_FIELD);
cur->name [LEN_LOGFONT_NAME_FIELD] = '\0';
cur->chset_head.next = NULL;
cur->next = NULL;
@@ -133,8 +133,8 @@ static void insert_chset (FAMILY* fami, const char* chset_name)
}
cur = (CHARSET*)malloc(sizeof(*cur));
strncpy (cur->name, chset_name, LEN_FONT_NAME);
cur->name [LEN_FONT_NAME] = '\0';
strncpy (cur->name, chset_name, LEN_LOGFONT_NAME_FIELD);
cur->name [LEN_LOGFONT_NAME_FIELD] = '\0';
cur->next = NULL;
pre->next = cur;
@@ -416,7 +416,7 @@ static void insert_strings (HWND hWnd, char** strs, int str_num)
static int fresh_chset_list (HWND hWnd)
{
char str_buffer [LEN_FONT_NAME + 1];
char str_buffer [LEN_LOGFONT_NAME_FIELD + 1];
HWND fami_lb;
HWND chset_lb;
int cur_sel;
@@ -455,7 +455,7 @@ static int fresh_chset_list (HWND hWnd)
static int insert_listboxs (HWND hWnd)
{
FAMILY* fami_cur = ((FAMILY*)GetWindowAdditionalData(hWnd))->next;
char str_buffer [LEN_FONT_NAME + 1];
char str_buffer [LEN_LOGFONT_NAME_FIELD + 1];
int i;
HWND hctrl;
@@ -496,8 +496,8 @@ static int insert_listboxs (HWND hWnd)
static LOGFONT* create_sel_font(HWND hWnd)
{
char family [LEN_FONT_NAME +1];
char chset [LEN_FONT_NAME +1];
char family [LEN_LOGFONT_NAME_FIELD +1];
char chset [LEN_LOGFONT_NAME_FIELD +1];
char weight;
char slant;
char flip;
+4 -4
View File
@@ -1,9 +1,9 @@
noinst_HEADERS = \
accelkey.h bidi.h bitmap.h cliprect.h ctrlclass.h \
noinst_HEADERS = \
accelkey.h bidi.h bitmap.h cliprect.h ctrlclass.h \
cursor.h dc.h event.h list.h element.h \
ial.h inline.h internals.h zorder.h menu.h misc.h \
ial.h inline.h internals.h zorder.h menu.h misc.h \
msgstr.h sysfont.h timer.h devfont.h fontname.h \
readbmp.h icon.h blockheap.h \
ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \
gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \
md5.h glyph.h license.h mgsock.h
md5.h glyph.h license.h mgsock.h unicode-ops.h
+15 -12
View File
@@ -62,24 +62,27 @@ extern "C" {
typedef struct _TYPERUN TYPERUN;
typedef struct _BIDICHAR_MIRROR_MAP {
Glyph32 glyph;
Glyph32 mirrored;
Achar32 chv;
Achar32 mirrored;
} BIDICHAR_MIRROR_MAP;
typedef void (*CB_DO_REORDER) (void* context, int len, int pos);
Achar32* __mg_charset_bidi_achars_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel,
void* extra, CB_REVERSE_EXTRA cb_reverse_extra);
Glyph32* __mg_charset_bidi_glyphs_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len);
/*
Achar32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel);
Glyph32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs,
int len, GLYPHMAPINFO* map);
Achar32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel);
*/
void __mg_charset_bidi_get_embeddlevels (const CHARSETOPS* charset_ops, Glyph32* glyphs,
int len, Uint8* embedding_level_list, Uint8 type);
void __mg_charset_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel, Uint8* embedding_levels, Uint8 type);
Glyph32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs,
int len, int* index_map);
Uint32 __mg_charset_bidi_str_base_dir (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len);
Uint32 __mg_charset_bidi_str_base_dir (const CHARSETOPS* charset_ops,
Achar32* achars, int len);
#ifdef __cplusplus
}
+1
View File
@@ -159,6 +159,7 @@ struct tagDC
int tabstop;
int cExtra; /* Character extra */
int wExtra; /* Word extra */
int alExtra; /* Above line extra */
int blExtra; /* Bellow line extra */
+108 -41
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -53,6 +53,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type);
int fontConvertFontType (const char* type);
BOOL fontGetFamilyFromName (const char* name, char* family);
BOOL fontDoesMatchFamily (const char* name, const char* family);
BOOL fontCopyStyleFromName (const char* name, char* style);
DWORD fontGetStyleFromName (const char* name);
-2
View File
@@ -41,8 +41,6 @@
#ifndef GUI_GDI_GLYPH_H
#define GUI_GDI_GLYPH_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+66
View File
@@ -0,0 +1,66 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** unicode-ops.h: Declaration of Unicode operators.
**
** Current maintainer: Wei Yongming.
**
** Create date: 2019/02/26
*/
#ifndef GUI_UNICODE_OPS_H
#define GUI_UNICODE_OPS_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
BOOL _unicode_is_emoji(Uchar32 ch);
BOOL _unicode_is_emoji_presentation(Uchar32 ch);
BOOL _unicode_is_emoji_modifier(Uchar32 ch);
BOOL _unicode_is_emoji_modifier_base(Uchar32 ch);
BOOL _unicode_is_emoji_extended_pictographic(Uchar32 ch);
BOOL _unicode_is_emoji_text_default(Uchar32 ch);
BOOL _unicode_is_emoji_emoji_default(Uchar32 ch);
BOOL _unicode_is_emoji_keycap_base(Uchar32 ch);
BOOL _unicode_is_regional_indicator(Uchar32 ch);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif // GUI_UNICODE_OPS_H
+1 -1
View File
@@ -1038,7 +1038,7 @@ static int srvChangeCaption (int cli, int idx_znode, const char *caption)
if (caplen < 32) {
strcpy (nodes[idx_znode].caption, caption);
} else {
GetTextCharPos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
get_text_char_pos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
&fit_chars, pos_chars);
memcpy(nodes[idx_znode].caption,
caption, pos_chars[fit_chars-1]);
+4 -4
View File
@@ -1340,11 +1340,11 @@ static HWND dskSetActiveZOrderNode (int cli, int idx_znode)
return old_hwnd;
}
static void GetTextCharPos (PLOGFONT log_font, const char *text,
static void get_text_char_pos (PLOGFONT log_font, const char *text,
int len, int fit_bytes, int *fit_chars, int *pos_chars)
{
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->devfonts[0];
DEVFONT* mbc_devfont = log_font->devfonts[1];
int len_cur_char;
int left_bytes = len;
int char_count = 0, bytes = 0;
@@ -1624,7 +1624,7 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win,
strcpy (nodes[free_slot].caption, caption);
} else {
int tail_pos;
GetTextCharPos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
get_text_char_pos (menufont, caption, caplen, (32 - 3), /* '...' = 3*/
&fit_chars, pos_chars);
tail_pos = pos_chars[fit_chars-1];
+1 -1
View File
@@ -78,7 +78,7 @@ static pthread_mutex_t timerLock;
#define TIMER_UNLOCK()
#endif
#ifdef __LINUX__
#if defined(__LINUX__) && defined(_MGRM_THREADS)
# define _MG_USE_BETTER_TIMER
#endif /* __LINUX__ */
+13 -87
View File
@@ -1415,7 +1415,6 @@ static int _PutBoxKey (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w, U
dstrow += dst->pitch;
}
}
#ifndef _FOR_MONOBITMAP
else while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
@@ -1426,29 +1425,7 @@ static int _PutBoxKey (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w, U
unsigned sG;
unsigned sB;
RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if ( pixel != ckey ) {
RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
ASSEMBLE_RGBA (dstpixels, bpp, dstfmt, sR, sG, sB, alpha);
}
dstpixels += bpp;
srcpixels += bpp;
},
w);
srcrow += box->bmPitch;
dstrow += dst->pitch;
}
#else
else while ( h-- ) {
dstpixels = dstrow;
srcpixels = srcrow;
DUFFS_LOOP(
{
Uint32 pixel;
unsigned sR;
unsigned sG;
unsigned sB;
RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if (pixel != ckey || ( pixel == ckey && box->bmType & BMP_TYPE_MONOKEY) ) {
if (pixel != ckey || (pixel == ckey && box->bmType & BMP_TYPE_REPLACEKEY)) {
if (pixel == ckey)
pixel = box->bmColorRep;
RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
@@ -1461,7 +1438,6 @@ static int _PutBoxKey (GAL_Surface* dst, BYTE* dstrow, BYTE* srcrow, Uint32 w, U
srcrow += box->bmPitch;
dstrow += dst->pitch;
}
#endif
return 0;
}
@@ -1929,76 +1905,26 @@ BYTE* gal_PutPixelKeyAlphaChannel (GAL_Surface* dst, BYTE* dstrow,
BYTE* gal_PutPixelKey (GAL_Surface* dst, BYTE* dstrow,
Uint32 pixel, MYBITMAP_CONTXT* mybmp)
{
//BYTE* dstpixels = dstrow;
//BYTE* srcpixels = srcrow;
Uint32 ckey = mybmp->colorKey;
GAL_PixelFormat *dstfmt = dst->format;
int bpp = dstfmt->BytesPerPixel;
unsigned alpha = dstfmt->Amask ? GAL_ALPHA_OPAQUE : 0;
if (bpp == 1) {
//while (h--) {
//unsigned int i;
//dstpixels = dstrow;
//srcpixels = srcrow;
//for (i = 0; i < w; i++) {
if (pixel != ckey)
*dstrow = pixel;
dstrow += bpp;
//srcpixels += bpp;
//}
//srcrow += box->bmPitch;
//dstrow += dst->pitch;
//}
if (pixel != ckey)
*dstrow = pixel;
dstrow += bpp;
}
#ifndef _FOR_MONOBITMAP
else /*while ( h-- )*/ {
//dstpixels = dstrow;
//srcpixels = srcrow;
//DUFFS_LOOP(
{
//Uint32 pixel;
unsigned sR;
unsigned sG;
unsigned sB;
//RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
if ( pixel != ckey ) {
RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
ASSEMBLE_RGBA (dstrow, bpp, dstfmt, sR, sG, sB, alpha);
}
dstrow += bpp;
//srcpixels += bpp;
}//,
//w);
//srcrow += box->bmPitch;
//dstrow += dst->pitch;
else {
unsigned sR;
unsigned sG;
unsigned sB;
if (pixel != ckey) {
RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
ASSEMBLE_RGBA (dstrow, bpp, dstfmt, sR, sG, sB, alpha);
}
dstrow += bpp;
}
#else
else /*while ( h-- )*/ {
//dstpixels = dstrow;
//srcpixels = srcrow;
//DUFFS_LOOP(
{
//Uint32 pixel;
unsigned sR;
unsigned sG;
unsigned sB;
//RETRIEVE_RGB_PIXEL (srcpixels, bpp, pixel);
//here,the MYBITMAP has no BMP_TYPE_MONOKEY,need to fixed
if (pixel != ckey || ( pixel == ckey && mybmp->mybmp->flag & BMP_TYPE_MONOKEY) ) {
if (pixel == ckey)
pixel ^=1 ;
RGB_FROM_PIXEL (pixel, dstfmt, sR, sG, sB);
ASSEMBLE_RGBA (dstrow, bpp, dstfmt, sR, sG, sB, alpha);
}
dstrow += bpp;
//srcpixels += bpp;
}//,
//w);
//srcrow += box->bmPitch;
//dstrow += dst->pitch;
}
#endif
return dstrow;
}
+3 -4
View File
@@ -4,8 +4,7 @@ noinst_LTLIBRARIES = libnewgdi.la
if MG_MINIMALGDI
SRC_FILES = gdi.c attr.c clip.c coor.c rect.c \
bitmap.c \
pixel.c pixel_ops.c \
bitmap.c pixel.c pixel_ops.c \
region.c polygon.c
else
SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
@@ -14,8 +13,8 @@ SRC_FILES = gdi.c attr.c clip.c map.c coor.c rect.c \
region.c generators.c polygon.c flood.c \
advapi.c midash.c mispans.c miwideline.c \
mifillarc.c mifpolycon.c miarc.c rotatebmp.c \
text.c glyph.c bidi.c \
textout.c tabbedtextout.c drawtext.c
text.c achar.c glyph.c bidi.c glyph-unicode.c \
textout.c tabbedtextout.c drawtext.c
endif
HDR_FILES = drawtext.h mi.h midc.h mistruct.h miwideline.h \
+198
View File
@@ -0,0 +1,198 @@
/*
* 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/>.
*/
/*
** achar.c: API implementation for abstract character.
**
** Create date: 2019/03/05
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#include "window.h"
#include "devfont.h"
Achar32 GUIAPI GetACharValue (LOGFONT* logfont, const char* mchar,
int mchar_len, const char* pre_mchar, int pre_len)
{
int len_cur_char;
Achar32 chv = INV_ACHAR_VALUE;
DEVFONT* sbc_devfont = logfont->devfonts[0];
DEVFONT* mbc_devfont = logfont->devfonts[1];
if (mbc_devfont) {
len_cur_char = mbc_devfont->charset_ops->len_first_char
((const unsigned char*)mchar, mchar_len);
if (len_cur_char > 0) {
chv = mbc_devfont->charset_ops->get_char_value
((Uint8*)pre_mchar, pre_len, (Uint8*)mchar, mchar_len);
return SET_MBCHV(chv);
}
}
len_cur_char = sbc_devfont->charset_ops->len_first_char
((const unsigned char*)mchar, mchar_len);
if (len_cur_char > 0) {
chv = sbc_devfont->charset_ops->get_char_value
(NULL, 0, (Uint8*)mchar, mchar_len);
}
return chv;
}
Achar32 GUIAPI GetShapedAChar (LOGFONT* logfont, const char* mchar,
int mchar_len, ACHARSHAPETYPE shape_type)
{
int len_cur_char;
Achar32 chv = INV_ACHAR_VALUE;
DEVFONT* sbc_devfont = logfont->devfonts[0];
DEVFONT* mbc_devfont = logfont->devfonts[1];
if (mbc_devfont) {
len_cur_char = mbc_devfont->charset_ops->len_first_char (
(const unsigned char*)mchar, mchar_len);
if (len_cur_char > 0) {
if (mbc_devfont->charset_ops->get_shaped_char_value)
chv = mbc_devfont->charset_ops->get_shaped_char_value(
(const unsigned char*)mchar, mchar_len, shape_type);
else
chv = mbc_devfont->charset_ops->get_char_value
(NULL, 0, (Uint8*)mchar, len_cur_char);
return SET_MBCHV(chv);
}
}
len_cur_char = sbc_devfont->charset_ops->len_first_char
((const unsigned char*)mchar, mchar_len);
if (len_cur_char > 0) {
if (sbc_devfont->charset_ops->get_shaped_char_value)
chv = sbc_devfont->charset_ops->get_shaped_char_value(
(const unsigned char*)mchar, mchar_len, shape_type);
else
chv = sbc_devfont->charset_ops->get_char_value
(NULL, 0, (Uint8*)mchar, len_cur_char);
}
return chv;
}
BOOL GUIAPI GetMirrorAChar (LOGFONT* logfont, Achar32 chv, Achar32* mirrored)
{
DEVFONT* devfont = SELECT_DEVFONT_BY_ACHAR(logfont, chv);
*mirrored = INV_ACHAR_VALUE;
if (devfont->charset_ops->bidi_mirror_char) {
return devfont->charset_ops->bidi_mirror_char(REAL_ACHAR(chv),
mirrored);
}
return FALSE;
}
Uint32 GUIAPI GetACharType (LOGFONT* logfont, Achar32 chv)
{
DEVFONT* devfont = SELECT_DEVFONT_BY_ACHAR(logfont, chv);
return devfont->charset_ops->char_type (REAL_ACHAR (chv));
}
Uint32 GetGlyphBIDIType (LOGFONT* log_font, Achar32 chv)
{
DEVFONT* devfont = SELECT_DEVFONT_BY_ACHAR(log_font, chv);
if (devfont == NULL ||
devfont->charset_ops->bidi_char_type == NULL)
return BIDI_TYPE_INVALID;
return devfont->charset_ops->bidi_char_type (REAL_ACHAR (chv));
}
#ifdef _MGCHARSET_UNICODE
Uchar32 GUIAPI Achar2UChar(LOGFONT* logfont, Achar32 chv)
{
Uchar32 uc;
DEVFONT* devfont = SELECT_DEVFONT_BY_ACHAR(logfont, chv);
if (devfont) {
chv = REAL_ACHAR(chv);
if (devfont->charset_ops->conv_to_uc32)
uc = devfont->charset_ops->conv_to_uc32(chv);
else
uc = chv;
return uc;
}
return 0;
}
int GUIAPI AChars2UChars(LOGFONT* logfont, const Achar32* chs,
Uchar32* ucs, int n)
{
int i;
Uchar32 uc;
DEVFONT* devfont;
for (i = 0; i < n; i++) {
Achar32 chv = chs[i];
devfont = SELECT_DEVFONT_BY_ACHAR(logfont, chv);
if (devfont) {
chv = REAL_ACHAR(chv);
if (devfont->charset_ops->conv_to_uc32)
uc = devfont->charset_ops->conv_to_uc32(chv);
else
uc = chv;
ucs[i] = uc;
}
else
return i + 1;
}
return TRUE;
}
#endif /* _MGCHARSET_UNICODE */
+17 -9
View File
@@ -162,7 +162,8 @@ static void make_gray_pixels (PDC pdc)
static void make_filter_pixels (PDC pdc)
{
if (pdc->pLogFont->style & FS_WEIGHT_BOOK) {
switch (pdc->pLogFont->style & FS_RENDER_MASK) {
case FS_RENDER_GREY: {
int i;
Uint8 r, g, b, a;
@@ -180,16 +181,23 @@ static void make_filter_pixels (PDC pdc)
pdc->filter_pixels [16] = GAL_MapRGBA (pdc->alpha_pixel_format,
r, g, b, 255);
break;
}
else if (pdc->pLogFont->style & FS_WEIGHT_LIGHT) {
gal_pixel trans = pdc->bkcolor ^ 1;
if (trans == pdc->textcolor)
trans = pdc->bkcolor ^ 3;
pdc->filter_pixels [0] = trans;
pdc->filter_pixels [1] = pdc->bkcolor;
pdc->filter_pixels [2] = pdc->textcolor;
case FS_RENDER_MONO:
if (pdc->pLogFont->style & FS_DECORATE_OUTLINE) {
gal_pixel trans = pdc->bkcolor ^ 1;
if (trans == pdc->textcolor)
trans = pdc->bkcolor ^ 3;
pdc->filter_pixels [0] = trans;
pdc->filter_pixels [1] = pdc->bkcolor;
pdc->filter_pixels [2] = pdc->textcolor;
}
break;
default:
break;
}
}
+398 -547
View File
File diff suppressed because it is too large Load Diff
+13 -226
View File
File diff suppressed because it is too large Load Diff
+16 -4
View File
@@ -61,8 +61,20 @@ typedef struct _BBOX
int w, h;
} BBOX;
int _gdi_get_glyph_advance (PDC pdc, Glyph32 glyph_value,
BOOL direction, int x, int y, int* adv_x, int* adv_y, BBOX* bbox);
int _font_get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
Glyph32 glyph_value, BOOL direction, int ch_extra,
int x, int y, int* adv_x, int* adv_y, BBOX* bbox);
static inline int _gdi_get_glyph_advance (PDC pdc, Glyph32 glyph_value,
BOOL direction, int x, int y, int* adv_x, int* adv_y, BBOX* bbox)
{
LOGFONT* logfont = pdc->pLogFont;
DEVFONT* devfont = SELECT_DEVFONT_BY_GLYPH(logfont, glyph_value);
glyph_value = REAL_GLYPH (glyph_value);
return _font_get_glyph_advance (logfont, devfont, glyph_value,
direction, pdc->cExtra, x, y, adv_x, adv_y, bbox);
}
int _gdi_draw_one_glyph (PDC pdc, Glyph32 glyph_value, BOOL direction,
int x, int y, int* adv_x, int* adv_y);
@@ -77,9 +89,9 @@ void _gdi_calc_glyphs_size_from_two_points (PDC pdc, int x0, int y0,
int x1, int y1, SIZE* size);
typedef BOOL (*CB_ONE_GLYPH) (void* context, Glyph32 glyph_value,
int glyph_type);
unsigned int char_type);
int _gdi_output_visual_glyphs(PDC pdc, Glyph32* visual_glyphs, int nr_glyphs,
int _gdi_output_visual_achars(PDC pdc, Glyph32* visual_glyphs, int nr_glyphs,
BOOL direction, CB_ONE_GLYPH cb_one_glyph, void* context);
int _gdi_reorder_text (PDC pdc, const unsigned char* text, int text_len,
+11 -6
View File
@@ -1733,7 +1733,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient)
pdc->pLogFont = GetSystemFont (SYSLOGFONT_WCHAR_DEF);
pdc->tabstop = 8;
pdc->CurTextPos.x = pdc->CurTextPos.y = 0;
pdc->cExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->cExtra = pdc->wExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->mapmode = MM_TEXT;
pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP;
@@ -1812,6 +1812,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient)
[pdc->surface->format->BytesPerPixel - 1];
pdc->draw_src_span = draw_src_span_ops [pdc->rop]
[pdc->surface->format->BytesPerPixel - 1];
pdc->user_comp_ctxt = pdc->surface->format;
pdc->cur_dst = (BYTE*)pdc->surface->pixels
+ pdc->surface->pitch * pdc->DevRC.top
@@ -1833,10 +1834,10 @@ static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref)
/* copy attributes from reference DC
* gal_pixel bkcolor, pencolor, brushcolor, textcolor;
* int bkmode, tabstop, cExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags;
* int bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags;
*/
memcpy (&pdc->bkcolor, &pdc_ref->bkcolor,
sizeof (gal_pixel)*4 + sizeof (int)*8);
sizeof (gal_pixel)*4 + sizeof (int)*9);
#ifdef _MGHAVE_ADV_2DAPI
memcpy (&pdc->pen_type, &pdc_ref->pen_type,
(sizeof(int)*7) + sizeof(POINT) + (sizeof (void*)*3));
@@ -1864,6 +1865,7 @@ static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref)
[pdc->surface->format->BytesPerPixel - 1];
pdc->draw_src_span = draw_src_span_ops [pdc->rop]
[pdc->surface->format->BytesPerPixel - 1];
pdc->user_comp_ctxt = pdc->surface->format;
pdc->cur_dst = (BYTE*)pdc->surface->pixels
+ pdc->surface->pitch * pdc->DevRC.top
@@ -1898,7 +1900,7 @@ static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface)
pdc->pLogFont = GetSystemFont (SYSLOGFONT_WCHAR_DEF);
pdc->tabstop = 8;
pdc->CurTextPos.x = pdc->CurTextPos.y = 0;
pdc->cExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->cExtra = pdc->wExtra = pdc->alExtra = pdc->blExtra = 0;
pdc->mapmode = MM_TEXT;
pdc->ta_flags = TA_LEFT | TA_TOP | TA_NOUPDATECP;
@@ -1955,6 +1957,7 @@ static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface)
[pdc->surface->format->BytesPerPixel - 1];
pdc->draw_src_span = draw_src_span_ops [pdc->rop]
[pdc->surface->format->BytesPerPixel - 1];
pdc->user_comp_ctxt = pdc->surface->format;
pdc->cur_dst = pdc->surface->pixels;
pdc->move_to = move_to_ops [pdc->surface->format->BytesPerPixel - 1];
@@ -1992,6 +1995,7 @@ int GUIAPI SetRasterOperation (HDC hdc, int rop)
[pdc->surface->format->BytesPerPixel - 1];
pdc->draw_src_span = draw_src_span_ops [rop]
[pdc->surface->format->BytesPerPixel - 1];
pdc->user_comp_ctxt = pdc->surface->format;
}
return old;
@@ -3434,8 +3438,8 @@ HWND GUIAPI WindowFromDC (HDC hdc)
typedef struct _DCSTATE
{
GAL_Color bkcolor, pencolor, brushcolor, textcolor;
/* bkmode, tabstop, cExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags */
char attrs_g1 [sizeof(int)*8];
/* bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags */
char attrs_g1 [sizeof(int)*9];
#ifdef _MGHAVE_ADV_2DAPI
/*
@@ -3643,6 +3647,7 @@ BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc)
[pdc->surface->format->BytesPerPixel - 1];
pdc->draw_src_span = draw_src_span_ops [pdc->rop]
[pdc->surface->format->BytesPerPixel - 1];
pdc->user_comp_ctxt = pdc->surface->format;
}
else if (ROP_COMP_USER == pdc->rop) {
pdc->draw_pixel = dc_state->user_set_pixel;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+482 -2316
View File
File diff suppressed because it is too large Load Diff
@@ -32,6 +32,8 @@
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
/*
** NOTE: DEPRECATED.
**
** logfont.c: Log fonts management.
**
** Current maintainer: Wei Yongming.
@@ -67,7 +69,7 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
{
PLOGFONT log_font;
int sbc_descent, mbc_descent = 0;
char dev_family [LEN_FONT_NAME + 1];
char dev_family [LEN_LOGFONT_NAME_FIELD + 1];
DEVFONT* sbc_devfont, *mbc_devfont;
// is valid style?
@@ -89,17 +91,17 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
#endif
if (type) {
strncpy (log_font->type, type, LEN_FONT_NAME);
log_font->type [LEN_FONT_NAME] = '\0';
strncpy (log_font->type, type, LEN_LOGFONT_NAME_FIELD);
log_font->type [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else
strcpy (log_font->type, FONT_TYPE_NAME_ALL);
strncpy (log_font->family, family, LEN_FONT_NAME);
log_font->family [LEN_FONT_NAME] = '\0';
strncpy (log_font->family, family, LEN_LOGFONT_NAME_FIELD);
log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
strncpy (log_font->charset, charset, LEN_FONT_NAME);
log_font->charset [LEN_FONT_NAME] = '\0';
strncpy (log_font->charset, charset, LEN_LOGFONT_NAME_FIELD);
log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
if (size > FONT_MAX_SIZE)
log_font->size = FONT_MAX_SIZE;
@@ -138,25 +140,25 @@ static PLOGFONT gdiCreateLogFont ( const char* type, const char* family,
// family name
if (log_font->mbc_devfont) {
fontGetFamilyFromName (log_font->mbc_devfont->name, dev_family);
strncpy (log_font->family, dev_family, LEN_FONT_NAME);
log_font->family [LEN_FONT_NAME] = '\0';
strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
fontGetFamilyFromName (log_font->sbc_devfont->name, dev_family);
strncpy (log_font->family, dev_family, LEN_FONT_NAME);
log_font->family [LEN_FONT_NAME] = '\0';
strncpy (log_font->family, dev_family, LEN_LOGFONT_NAME_FIELD);
log_font->family [LEN_LOGFONT_NAME_FIELD] = '\0';
}
// charset name
if (log_font->mbc_devfont) {
strncpy (log_font->charset,
log_font->mbc_devfont->charset_ops->name, LEN_FONT_NAME);
log_font->charset [LEN_FONT_NAME] = '\0';
log_font->mbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
else {
strncpy (log_font->charset,
log_font->sbc_devfont->charset_ops->name, LEN_FONT_NAME);
log_font->charset [LEN_FONT_NAME] = '\0';
log_font->sbc_devfont->charset_ops->name, LEN_LOGFONT_NAME_FIELD);
log_font->charset [LEN_LOGFONT_NAME_FIELD] = '\0';
}
// size
@@ -215,9 +217,9 @@ PLOGFONT GUIAPI CreateLogFont (const char* type, const char* family,
PLOGFONT GUIAPI CreateLogFontByName (const char* font_name)
{
char type[LEN_FONT_NAME + 1];
char family[LEN_FONT_NAME + 1];
char charset[LEN_FONT_NAME + 1];
char type[LEN_LOGFONT_NAME_FIELD + 1];
char family[LEN_LOGFONT_NAME_FIELD + 1];
char charset[LEN_LOGFONT_NAME_FIELD + 1];
DWORD style;
int height;
-2
View File
@@ -110,7 +110,6 @@ BOOL GUIAPI InitBitmapPixelFormat (HDC hdc, PBITMAP bmp)
if (bmp->bmType & BMP_TYPE_ALPHA) {
if (device_has_alpha(hdc) || bmp->bmBitsPerPixel <= 8) {
bmp->bmType &= ~BMP_TYPE_ALPHA_MASK;
bmp->bmType &= ~BMP_TYPE_PRIV_PIXEL;
return TRUE;
}
@@ -1262,7 +1261,6 @@ int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal
}
//bmp->bmType |= BMP_TYPE_ALPHA;
//bmp->bmType |= BMP_TYPE_PRIV_PIXEL;
}
else { /* for bpp <= 8, just strip alpha */
AlphaPixelFormat = pdc->surface->format;
+40 -23
View File
@@ -64,7 +64,7 @@ extern int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
static inline BOOL is_utf16_logfont (PDC pdc)
{
DEVFONT* mbc_devfont;
mbc_devfont = pdc->pLogFont->mbc_devfont;
mbc_devfont = pdc->pLogFont->devfonts[1];
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
return TRUE;
}
@@ -116,14 +116,14 @@ typedef struct _TABBEDTEXTOUT_CTXT
} TABBEDTEXTOUT_CTXT;
static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
int glyph_type)
unsigned int char_type)
{
TABBEDTEXTOUT_CTXT* ctxt = (TABBEDTEXTOUT_CTXT*)context;
int adv_x, adv_y;
BBOX bbox;
int bkmode = ctxt->pdc->bkmode;
switch (glyph_type) {
switch (char_type & CHARTYPE_MCHAR_MASK) {
case MCHAR_TYPE_ZEROWIDTH:
adv_x = adv_y = 0;
break;
@@ -143,6 +143,7 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
ctxt->x, ctxt->y, &adv_x, &adv_y);
}
break;
case MCHAR_TYPE_VOWEL:
if (!ctxt->only_extent) {
//ctxt->pdc->bkmode = BM_TRANSPARENT;
@@ -153,6 +154,7 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
}
adv_x = adv_y = 0;
break;
default:
if (ctxt->only_extent) {
ctxt->advance += _gdi_get_glyph_advance (ctxt->pdc,
@@ -194,13 +196,13 @@ typedef struct _TABBEDTEXTOUTEX_CTXT
} TABBEDTEXTOUTEX_CTXT;
static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
int glyph_type)
unsigned int char_type)
{
TABBEDTEXTOUTEX_CTXT* ctxt = (TABBEDTEXTOUTEX_CTXT*)context;
int adv_x, adv_y;
int tab_pos = ctxt->nTabOrig;
switch (glyph_type) {
switch (char_type & CHARTYPE_MCHAR_MASK) {
case MCHAR_TYPE_ZEROWIDTH:
adv_x = adv_y = 0;
break;
@@ -222,6 +224,7 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
ctxt->advance = tab_pos;
ctxt->nTabOrig = tab_pos;
break;
case MCHAR_TYPE_VOWEL:
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
@@ -329,8 +332,8 @@ int GUIAPI TabbedTextOutLen (HDC hdc, int x, int y,
if (len < 0) len = __mg_strlen (pdc->pLogFont, spText);
if (len == 0) return 0;
tab_width = pdc->pLogFont->sbc_devfont->font_ops->get_ave_width
(pdc->pLogFont, pdc->pLogFont->sbc_devfont) * pdc->tabstop;
tab_width = pdc->pLogFont->devfonts[0]->font_ops->get_ave_width
(pdc->pLogFont, pdc->pLogFont->devfonts[0]) * pdc->tabstop;
/* override start point by current text position */
if ((pdc->ta_flags & TA_CP_MASK) == TA_UPDATECP) {
@@ -376,8 +379,8 @@ int GUIAPI GetTabbedTextExtent (HDC hdc, const char* spText, int len,
return 0;
}
tab_width = pdc->pLogFont->sbc_devfont->font_ops->get_ave_width
(pdc->pLogFont, pdc->pLogFont->sbc_devfont) * pdc->tabstop;
tab_width = pdc->pLogFont->devfonts[0]->font_ops->get_ave_width
(pdc->pLogFont, pdc->pLogFont->devfonts[0]) * pdc->tabstop;
advance = _gdi_tabbed_text_out (pdc, 0, 0, (const unsigned char*) spText,
len, tab_width, TRUE, NULL, &size);
@@ -397,8 +400,8 @@ int _gdi_tabbedex_text_out (PDC pdc, int x, int y,
#if 0
DEVFONT* sbc_devfont;
DEVFONT* mbc_devfont;
sbc_devfont = pdc->pLogFont->sbc_devfont;
mbc_devfont = pdc->pLogFont->mbc_devfont;
sbc_devfont = pdc->pLogFont->devfonts[0];
mbc_devfont = pdc->pLogFont->devfonts[1];
#endif
ctxt.pdc = pdc;
@@ -481,8 +484,8 @@ int GUIAPI TabbedTextOutEx (HDC hdc, int x, int y, const char* spText,
if (nCount == 0) return 0;
if (nTabs == 0 || pTabPos == NULL) {
int ave_width = (*pdc->pLogFont->sbc_devfont->font_ops->get_ave_width)
(pdc->pLogFont, pdc->pLogFont->sbc_devfont);
int ave_width = (*pdc->pLogFont->devfonts[0]->font_ops->get_ave_width)
(pdc->pLogFont, pdc->pLogFont->devfonts[0]);
def_tab = ave_width * pdc->tabstop;
}
else
@@ -516,8 +519,8 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
{
PDC pdc = dc_HDC2PDC (hdc);
LOGFONT* log_font = pdc->pLogFont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->devfonts[0];
DEVFONT* mbc_devfont = log_font->devfonts[1];
DEVFONT* devfont;
int left_bytes = len;
int len_cur_char;
@@ -530,7 +533,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
size->cx = size->cy = 0;
/* This function does not support BIDI */
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type)
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type)
return -1;
_gdi_start_new_line (pdc);
@@ -538,7 +541,7 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
tab_width = sbc_devfont->font_ops->get_ave_width (log_font, sbc_devfont)
* pdc->tabstop;
line_height = log_font->size + pdc->alExtra + pdc->blExtra;
size->cy = line_height;
size->cy = line_height;
while (left_bytes > 0) {
if (pos_chars)
@@ -563,16 +566,30 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
}
if (devfont) {
int glyph_type;
int char_type;
glyph_value = devfont->charset_ops->char_glyph_value
glyph_value = devfont->charset_ops->get_char_value
(NULL, 0, (const unsigned char*)text, len_cur_char);
glyph_type = devfont->charset_ops->glyph_type (glyph_value);
char_type = devfont->charset_ops->char_type (glyph_value);
if(devfont == mbc_devfont)
glyph_value |= 0x80000000;
if (devfont == mbc_devfont) {
int i, dfi;
DEVFONT* df;
switch (glyph_type) {
dfi = 1;
for (i = 1; i < MAXNR_DEVFONTS; i++) {
if ((df = log_font->devfonts[i])) {
if (df->font_ops->is_glyph_existed(log_font, df,
glyph_value)) {
dfi = i;
break;
}
}
}
glyph_value = SET_GLYPH_DFI(glyph_value, dfi);
}
switch (char_type & CHARTYPE_MCHAR_MASK) {
case MCHAR_TYPE_ZEROWIDTH:
case MCHAR_TYPE_VOWEL:
break;
+13 -9
View File
@@ -61,18 +61,22 @@ int GUIAPI GetFontHeight (HDC hdc)
int GUIAPI GetMaxFontWidth (HDC hdc)
{
int i;
DEVFONT* df;
PDC pdc = dc_HDC2PDC(hdc);
DEVFONT* sbc_devfont = pdc->pLogFont->sbc_devfont;
DEVFONT* mbc_devfont = pdc->pLogFont->mbc_devfont;
int sbc_max_width = (*sbc_devfont->font_ops->get_max_width)
(pdc->pLogFont, sbc_devfont);
int mbc_max_width = 0;
int max_width = 0;
if (mbc_devfont)
mbc_max_width = (*mbc_devfont->font_ops->get_max_width)
(pdc->pLogFont, mbc_devfont);
for (i = 0; i < MAXNR_DEVFONTS; i++) {
int value;
df = pdc->pLogFont->devfonts[i];
if (df == NULL)
break;
return (sbc_max_width > mbc_max_width) ? sbc_max_width : mbc_max_width;
value = df->font_ops->get_max_width(pdc->pLogFont, df);
max_width = MAX(max_width, value);
}
return max_width;
}
void GUIAPI GetLastTextOutPos (HDC hdc, POINT* pt)
+36 -22
View File
@@ -64,7 +64,7 @@ extern int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
static inline BOOL is_utf16_logfont (PDC pdc)
{
DEVFONT* mbc_devfont;
mbc_devfont = pdc->pLogFont->mbc_devfont;
mbc_devfont = pdc->pLogFont->devfonts[1];
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
return TRUE;
}
@@ -106,16 +106,16 @@ typedef struct _DRAW_GLYPHS_CTXT {
int advance;
} DRAW_GLYPHS_CTXT;
static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, int glyph_type)
static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char_type)
{
DRAW_GLYPHS_CTXT* ctxt = (DRAW_GLYPHS_CTXT*)context;
int adv_x, adv_y;
int bkmode;
if (glyph_type == MCHAR_TYPE_ZEROWIDTH) {
if (check_zero_width(char_type)) {
adv_x = adv_y = 0;
}
else if (glyph_type == MCHAR_TYPE_VOWEL){
else if (check_vowel(char_type)) {
bkmode = GetBkMode (ctxt->hdc);
//SetBkMode (ctxt->hdc, BM_TRANSPARENT);
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y);
@@ -138,10 +138,10 @@ int DrawGlyphString (HDC hdc, int startx, int starty, Glyph32* glyph_string, int
DRAW_GLYPHS_CTXT ctxt = {hdc, startx, starty, 0};
if ((((PDC)hdc)->ta_flags & TA_X_MASK) == TA_LEFT)
_gdi_output_visual_glyphs((PDC)hdc, glyph_string,
_gdi_output_visual_achars((PDC)hdc, glyph_string,
len, TRUE, cb_draw_glyph, &ctxt);
else
_gdi_output_visual_glyphs((PDC)hdc, glyph_string,
_gdi_output_visual_achars((PDC)hdc, glyph_string,
len, FALSE, cb_draw_glyph, &ctxt);
if (adv_x)
@@ -162,18 +162,18 @@ typedef struct _TEXTOUT_CTXT
BOOL only_extent;
} TEXTOUT_CTXT;
static BOOL cb_textout (void* context, Glyph32 glyph_value, int glyph_type)
static BOOL cb_textout (void* context, Glyph32 glyph_value,
unsigned int char_type)
{
TEXTOUT_CTXT* ctxt = (TEXTOUT_CTXT*)context;
int adv_x, adv_y;
int bkmode;
if (glyph_type == MCHAR_TYPE_ZEROWIDTH) {
if (check_zero_width (char_type)) {
adv_x = adv_y = 0;
}
else if (glyph_type == MCHAR_TYPE_VOWEL){
if (!ctxt->only_extent)
{
else if (check_vowel(char_type)) {
if (!ctxt->only_extent) {
bkmode = ctxt->pdc->bkmode;
//ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
@@ -182,8 +182,8 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value, int glyph_type)
ctxt->pdc->bkmode = bkmode;
}
//adv_x = adv_y = 0;
adv_x = 0;
//adv_x = adv_y = 0;
adv_x = 0;
}
else {
if (ctxt->only_extent)
@@ -326,7 +326,7 @@ typedef struct _TEXTOUTOMITTED_CTXT
Uint32 max_extent;
} TEXTOUTOMITTED_CTXT;
static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, int glyph_type)
static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int char_type)
{
TEXTOUTOMITTED_CTXT* ctxt = (TEXTOUTOMITTED_CTXT*)context;
int adv_x, adv_y;
@@ -334,10 +334,10 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, int glyph_ty
//BBOX bbox;
int bkmode = ctxt->pdc->bkmode;
if (glyph_type == MCHAR_TYPE_ZEROWIDTH) {
if (check_zero_width(char_type)) {
adv_x = adv_y = 0;
}
else if(glyph_type == MCHAR_TYPE_VOWEL) {
else if (check_vowel(char_type)) {
//ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
@@ -452,8 +452,8 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
{
PDC pdc = dc_HDC2PDC (hdc);
LOGFONT* log_font = pdc->pLogFont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->devfonts[0];
DEVFONT* mbc_devfont = log_font->devfonts[1];
int len_cur_char, advance_cur_char;
int left_bytes = len;
int char_count = 0;
@@ -463,7 +463,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
size->cx = size->cy = 0;
/* This function does not support BIDI */
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_glyph_type)
if (mbc_devfont && pdc->bidi_flags && mbc_devfont->charset_ops->bidi_char_type)
return -1;
_gdi_start_new_line(pdc);
@@ -479,11 +479,25 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
if (mbc_devfont &&
(len_cur_char = mbc_devfont->charset_ops->len_first_char
((const unsigned char*)text, left_bytes)) > 0) {
int i, dfi;
DEVFONT* df;
glyph_value = (*mbc_devfont->charset_ops->char_glyph_value)(NULL,
glyph_value = (*mbc_devfont->charset_ops->get_char_value)(NULL,
0, (const unsigned char*)text, 0);
advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value | 0x80000000,
dfi = 1;
for (i = 1; i < MAXNR_DEVFONTS; i++) {
if ((df = log_font->devfonts[i])) {
if (df->font_ops->is_glyph_existed(log_font, df,
glyph_value)) {
dfi = i;
break;
}
}
}
glyph_value = SET_GLYPH_DFI(glyph_value, dfi);
advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value,
(pdc->ta_flags & TA_X_MASK) == TA_LEFT,
0, 0, NULL, NULL, NULL);
}
@@ -491,7 +505,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
if ((len_cur_char = sbc_devfont->charset_ops->len_first_char
((const unsigned char*)text, left_bytes)) > 0) {
glyph_value = (*sbc_devfont->charset_ops->char_glyph_value)(
glyph_value = (*sbc_devfont->charset_ops->get_char_value)(
NULL, 0, (const unsigned char*)text, 0);
advance_cur_char = _gdi_get_glyph_advance (pdc, glyph_value,
(pdc->ta_flags & TA_X_MASK) == TA_LEFT,
+1 -1
View File
@@ -3850,7 +3850,7 @@ static int texteditor_get_text_count(mTextEditor* self, int start_with, BOOL bTe
return len;
}
if(plogfont->mbc_devfont == NULL)
if(plogfont->devfonts[1] == NULL)
return len;
while(idx < len)