Compare commits

...
155 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 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 82465 additions and 19361 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
+138 -4
View File
@@ -1,8 +1,142 @@
# 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
### 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
@@ -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.
+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;
+6 -6
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,
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_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
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_SETWIDTH_NORMAL,
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
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.
+2868 -612
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);
}
+9 -5
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\
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)
+17 -12
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
/*
* Set device name
*/
strncpy (bitmapfont_dev_font->name ,bmpfont_name, LEN_UNIDEVFONT_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;
+75 -71
View File
@@ -94,9 +94,9 @@ static const SHAPEINFO shape_info[SHAPENUMBER] = {
static int iso8859_6_is_this_charset (const unsigned char* charset)
{
int i;
char name [LEN_FONT_NAME + 1];
char name [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < LEN_FONT_NAME + 1; i++) {
for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
if (charset [i] == '\0')
break;
name [i] = toupper (charset [i]);
@@ -174,17 +174,17 @@ static unsigned short iso8859_68x_unicode_map [] =
0xFEF7, 0xFEF8, 0xFEF9, 0xFEFA, /*0x130~0x133*/
};
static UChar32 iso8859_6_conv_to_uc32 (Glyph32 glyph_value)
static Uchar32 iso8859_6_conv_to_uc32 (Achar32 chv)
{
if (glyph_value < 0x81)
return (Glyph32) (glyph_value);
else if (glyph_value <= MAX_GLYPH_VALUE )
return (Glyph32) iso8859_68x_unicode_map[glyph_value - 0x81];
if (chv < 0x81)
return (Achar32) (chv);
else if (chv <= MAX_GLYPH_VALUE )
return (Achar32) iso8859_68x_unicode_map[chv - 0x81];
else
return 0xFFFF;
}
static int iso8859_6_conv_from_uc32 (UChar32 wc, unsigned char* mchar)
static int iso8859_6_conv_from_uc32 (Uchar32 wc, unsigned char* mchar)
{
switch (wc) {
case 0x060C:
@@ -212,8 +212,8 @@ static int iso8859_6_conv_from_uc32 (UChar32 wc, unsigned char* mchar)
}
#endif
/* must attetion the para s is arabic glyph value.*/
static int is_arabic_glyph_vowel(Uint8 c)
/* must attetion the para s is arabic chv value.*/
static int is_arabic_char_vowel(Uint8 c)
{
if ((c >= 0x81) && (c <= 0x86)) return 1;
@@ -256,7 +256,7 @@ static int is_arabic_glyph_vowel(Uint8 c)
/* this define is relative with fontset 0xa1~0xa7.
* it it used for ligature such as LAM+ALEF, one ligature
* have two fontset glyphs.*/
* have two fontset chvs.*/
#define LAM_ALIF 0x12C //0xA1A5
#define LAM_ALIF_F 0x12D //0xA1A6
@@ -272,15 +272,15 @@ static int is_arabic_glyph_vowel(Uint8 c)
/* Because the get_ligature is close relative with fontset 6.8x, so
* do it in the follow five functions, if the fontset is change, you only
* need to implement follow five interface.
* 1. get_vowel_glyph().
* 2. get_twovowel_glyph().
* 3. get_tadweel_glyph().
* 4. get_ligature_glyph().
* 5. get_punpoint_glyph().
* 1. get_vowel_char().
* 2. get_twovowel_char().
* 3. get_tadweel_char().
* 4. get_ligature_char().
* 5. get_punpoint_char().
* houhh 20080128.
* */
static int fontset_68x_get_punpoint_glyph(Uint8 c)
static int fontset_68x_get_punpoint_char(Uint8 c)
{
int ligature = -1;
switch(c){
@@ -293,7 +293,7 @@ static int fontset_68x_get_punpoint_glyph(Uint8 c)
return ligature;
}
static int fontset_68x_get_vowel_glyph(Uint8 c)
static int fontset_68x_get_vowel_char(Uint8 c)
{
int ligature = -1;
switch(c){
@@ -310,7 +310,7 @@ static int fontset_68x_get_vowel_glyph(Uint8 c)
return ligature;
}
static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, int* ignore)
static int fontset_68x_get_twovowel_char(unsigned char c, unsigned char next, int* ignore)
{
int ligature = -1;
if(c == SHADDA){
@@ -326,12 +326,12 @@ static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, i
}
else {
*ignore = 0;
ligature = fontset_68x_get_vowel_glyph(c);
ligature = fontset_68x_get_vowel_char(c);
}
return ligature;
}
static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joining, int* ignore)
static int fontset_68x_get_ligature_char(unsigned char c, BOOL prev_affects_joining, int* ignore)
{
int ligature = -1;
if(prev_affects_joining){
@@ -355,7 +355,7 @@ static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joi
return ligature;
}
static int fontset_68x_get_tadweel_glyph(unsigned char c, unsigned char next, int* ignore)
static int fontset_68x_get_tadweel_char(unsigned char c, unsigned char next, int* ignore)
{
int ligature = -1;
if(c == SHADDA){
@@ -400,12 +400,12 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
cur_char = *mchar;
ligature = fontset_68x_get_punpoint_glyph(cur_char);
ligature = fontset_68x_get_punpoint_char(cur_char);
if(ligature > 0) return ligature;
if(len == 1){
if (ISARABIC_VOWEL(cur_char)){
ligature = fontset_68x_get_vowel_glyph(cur_char);
ligature = fontset_68x_get_vowel_char(cur_char);
}
else if(cur_char == TADWEEL){
ligature = TADWEEL;
@@ -414,16 +414,16 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
else if(len > 1){
next = *(mchar+1);
if (ISARABIC_VOWEL(cur_char)){ /* two VOWEL, one must be SHADDA first. */
ligature = fontset_68x_get_twovowel_glyph(cur_char, next, ignore);
ligature = fontset_68x_get_twovowel_char(cur_char, next, ignore);
}
else if (cur_char == LAM) { /* LAM+ALEF+HAMAZ+MADDA ligature. */
ligature = fontset_68x_get_ligature_glyph(next, prev_affects_joining, ignore);
ligature = fontset_68x_get_ligature_char(next, prev_affects_joining, ignore);
}
else if(cur_char == TADWEEL){ /* TADWEEL combine with VOWEL*/
if(len > 2) next_next = *(mchar+2);
else next_next = 0;
ligature = fontset_68x_get_tadweel_glyph(next, next_next, ignore);
ligature = fontset_68x_get_tadweel_char(next, next_next, ignore);
if(ligature == -1 && cur_char == TADWEEL){
ligature = TADWEEL;
}
@@ -454,15 +454,15 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
static unsigned int iso8859_6_glyph_type (Glyph32 glyph_value)
static unsigned int iso8859_6_char_type (Achar32 chv)
{
unsigned int ch_type = MCHAR_TYPE_UNKNOWN;
if (is_arabic_glyph_vowel (glyph_value)){ /* is vowel */
if (is_arabic_char_vowel (chv)) { /* is vowel */
ch_type = MCHAR_TYPE_VOWEL;
}
else{
ch_type = sb_glyph_type (glyph_value);
ch_type = sb_char_type (chv);
}
return ch_type;
@@ -586,9 +586,9 @@ static Uint32 __mg_iso8859_68x_type[] = {
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
};
static unsigned int iso8859_6_bidi_glyph_type (Glyph32 glyph_value)
static unsigned int iso8859_6_bidi_char_type (Achar32 chv)
{
return __mg_iso8859_68x_type [REAL_GLYPH(glyph_value)];
return __mg_iso8859_68x_type [chv];
}
static int get_table_index(Uint8 c)
@@ -652,7 +652,11 @@ static int get_next_char(const unsigned char* mchar, int len)
return next_char;
}
Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, int prev_len, const unsigned char* mchar, int len)
#ifndef _DEBUG
static
#endif
Achar32 iso8859_6_get_char_value (const unsigned char* prev_mchar,
int prev_len, const unsigned char* mchar, int len)
{
BOOL next_affects_joining = FALSE, prev_affects_joining = FALSE;
int char_index, prev_index;
@@ -665,15 +669,15 @@ Glyph32 iso8859_6_char_glyph_value (const unsigned char* prev_mchar, int prev_le
char_index = get_table_index(*mchar);
/*current glyph has no transfiguration and has no ligature*/
/*current chv has no transfiguration and has no ligature*/
if (char_index < 0 && !ISARABIC_PUNC(*mchar)
&& !ISARABIC_VOWEL(*mchar) && !(*mchar == TADWEEL)) {
return *mchar;
}
if(prev_mchar){
if (prev_mchar) {
prev_index = get_table_index(*prev_mchar);
prev_affects_joining = ( prev_index >= 0 || is_char_transparent(*prev_mchar)) && (shape_info[prev_index].medial);
prev_affects_joining = (prev_index >= 0 || is_char_transparent(*prev_mchar)) && (shape_info[prev_index].medial);
// NUV prev_char = *prev_mchar;
/*houhh 20080505, check if ligature. */
if(prev_affects_joining) {
@@ -768,57 +772,57 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
/*if cur_len>1, search ligature shape,
* else search letter or phonetic symbol shape*/
static Glyph32 iso8859_6_glyph_shape (const unsigned char* cur_mchar,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type)
{
Glyph32 glyph_value = -1;
Achar32 chv = -1;
int ignore;
int index;
if (cur_len > 1)
{
if (shape_type == GLYPH_ISOLATED)
glyph_value = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
else if (shape_type != GLYPH_INITIAL) {
if (shape_type == ACHAR_ISOLATED)
chv = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
else if (shape_type != ACHAR_INITIAL) {
/* LAM+ALEF+HAMAZ+MADDA ligature. */
if (*cur_mchar == LAM)
glyph_value = fontset_68x_get_ligature_glyph(*(cur_mchar+1), TRUE, &ignore);
chv = fontset_68x_get_ligature_char(*(cur_mchar+1), TRUE, &ignore);
}
}
if (glyph_value == -1 || glyph_value == 0) {
if (chv == -1 || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){
glyph_value = fontset_68x_get_vowel_glyph(*cur_mchar);
chv = fontset_68x_get_vowel_char(*cur_mchar);
}
if (glyph_value == 0 || glyph_value == -1) {
if (chv == 0 || chv == -1) {
index = get_table_index(*cur_mchar);
if (index >=0)
{
switch (shape_type) {
case GLYPH_ISOLATED:
glyph_value = shape_info[index].isolated;
case ACHAR_ISOLATED:
chv = shape_info[index].isolated;
break;
case GLYPH_FINAL:
glyph_value = shape_info[index].final;
case ACHAR_FINAL:
chv = shape_info[index].final;
break;
case GLYPH_INITIAL:
glyph_value = shape_info[index].initial;
case ACHAR_INITIAL:
chv = shape_info[index].initial;
break;
case GLYPH_MEDIAL:
glyph_value = shape_info[index].medial;
case ACHAR_MEDIAL:
chv = shape_info[index].medial;
break;
}
}
else
glyph_value = *cur_mchar;
chv = *cur_mchar;
}
}
if (glyph_value == 0)
glyph_value =-1;
if (chv == 0)
chv =-1;
return glyph_value;
return chv;
}
static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
@@ -835,28 +839,28 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
// {0x00BB, 0x00AB}
};
static BOOL iso8859_6_bidi_mirror_glyph (Glyph32 glyph, Glyph32* mirrored)
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{
return get_mirror_glyph (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), glyph, mirrored);
return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
}
static CHARSETOPS CharsetOps_iso8859_6 = {
256,
3,
1,
FONT_CHARSET_ISO8859_6,
0,
iso8859_6_len_first_char,
iso8859_6_char_glyph_value,
iso8859_6_glyph_shape,
iso8859_6_glyph_type,
iso8859_6_get_char_value,
iso8859_6_get_shaped_char_value,
iso8859_6_char_type,
sb_nr_chars_in_str,
iso8859_6_is_this_charset,
sb_len_first_substr,
iso8859_6_get_next_word,
sb_pos_first_char,
iso8859_6_bidi_glyph_type,
iso8859_6_bidi_mirror_glyph,
iso8859_6_bidi_char_type,
iso8859_6_bidi_mirror_char,
#ifdef _MGCHARSET_UNICODE
iso8859_6_conv_to_uc32,
iso8859_6_conv_from_uc32
@@ -864,14 +868,14 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
};
#ifdef _DEBUG
int test_glyph_value (int char_index, Glyph32 glyph_value)
int iso8859_6_test_chv (int char_index, Achar32 chv)
{
int i = 0;
for (i = 0; i<SHAPENUMBER; i++) {
if (shape_info[i].isolated == glyph_value ||
shape_info[i].initial == glyph_value ||
shape_info[i].medial == glyph_value ||
shape_info[i].final == glyph_value )
if (shape_info[i].isolated == chv ||
shape_info[i].initial == chv ||
shape_info[i].medial == chv ||
shape_info[i].final == chv )
if( char_index == i)
return 1;
}
+115 -92
View File
@@ -133,7 +133,7 @@ static void print_run_types(TYPERUN *pp)
fprintf (stderr, "\n");
}
static void print_hexstr(Glyph32* str, int len, BOOL reorder_state)
static void print_hexstr(Achar32* str, int len, BOOL reorder_state)
{
int m = 0;
@@ -154,7 +154,7 @@ static void print_hexstr(Glyph32* str, int len, BOOL reorder_state)
#else /* BIDI_DEBUG */
inline static void print_hexstr(Glyph32* str, int len, BOOL reorder_state)
inline static void print_hexstr(Achar32* str, int len, BOOL reorder_state)
{
return;
}
@@ -218,7 +218,7 @@ static void compact_neutrals (TYPERUN *list)
(p) = (q); \
} while (0)
static TYPERUN* get_runtype_link (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len)
static TYPERUN* get_runtype_link (const CHARSETOPS* charset_ops, Achar32* achars, int len)
{
int type = 0;
TYPERUN *list, *last, *link;
@@ -231,7 +231,7 @@ static TYPERUN* get_runtype_link (const CHARSETOPS* charset_ops, Glyph32* glyphs
last = list;
for (i = 0; i < len; i++){
if ((type = charset_ops->bidi_glyph_type (glyphs[i])) != last->type){
if ((type = charset_ops->bidi_char_type (achars[i])) != last->type){
link = calloc(1, sizeof(TYPERUN));
link->type = type;
link->pos = i;
@@ -473,7 +473,7 @@ static int bidi_resolveImplicit(TYPERUN **ptype_rl_list, int base_level)
/* 6.Resolving Mirrored Char. */
static void
bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Achar32* achars, int len,
TYPERUN **ptype_rl_list, int base_level)
{
TYPERUN *type_rl_list = *ptype_rl_list, *pp = NULL;
@@ -486,9 +486,9 @@ bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
int i;
for (i = POS (pp); i < POS (pp) + LEN (pp); i++)
{
Glyph32 mirrored_ch;
if (charset_ops->bidi_mirror_glyph && charset_ops->bidi_mirror_glyph (glyphs[i], &mirrored_ch))
glyphs[i] = mirrored_ch;
Achar32 mirrored_ch;
if (charset_ops->bidi_mirror_char && charset_ops->bidi_mirror_char (achars[i], &mirrored_ch))
achars[i] = mirrored_ch;
}
}
}
@@ -496,43 +496,8 @@ bidi_resolveMirrorChar (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
DBGLOG (" Mirroring, Done\n");
}
static void bidi_map_reverse (void* context, int len, int pos)
{
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
GLYPHMAPINFO tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
static void bidi_index_reverse (void* context, int len, int pos)
{
char* str = (char*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
char tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
static void bidi_string_reverse (void* context, int len, int pos)
{
Glyph32* str = (Glyph32*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
Glyph32 tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
static void bidi_resolve_string (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
static void bidi_resolve_string (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel,
TYPERUN **ptype_rl_list, BYTE *pmax_level)
{
BYTE base_level = 0;
@@ -540,10 +505,16 @@ static void bidi_resolve_string (const CHARSETOPS* charset_ops, Glyph32* glyphs,
TYPERUN *type_rl_list = NULL;
/* split the text to some runs. */
type_rl_list = get_runtype_link (charset_ops, glyphs, len);
type_rl_list = get_runtype_link (charset_ops, achars, len);
/* 1.Find base level */
if (pel != 0 && pel != 1) {
bidi_resolveParagraphs(&type_rl_list, &base_dir, &base_level);
}
else {
base_level = pel;
base_dir = BIDI_LEVEL_TO_DIR (base_level);
}
/* 2.Resolving Explicit levels.*/
bidi_resolveExplicit(&type_rl_list, base_dir);
@@ -558,13 +529,31 @@ static void bidi_resolve_string (const CHARSETOPS* charset_ops, Glyph32* glyphs,
*pmax_level = bidi_resolveImplicit(&type_rl_list, base_level);
/* 6.Resolving Mirrored Char. */
bidi_resolveMirrorChar (charset_ops, glyphs, len, &type_rl_list, base_level);
bidi_resolveMirrorChar (charset_ops, achars, len, &type_rl_list, base_level);
*ptype_rl_list = type_rl_list;
}
static void bidi_reorder_cb (void* context, int len,
TYPERUN **ptype_rl_list, BYTE max_level, CB_DO_REORDER cb)
typedef struct _REORDER_CONTEXT {
Achar32* achars;
void* extra;
CB_REVERSE_EXTRA cb;
} REORDER_CONTEXT;
static void bidi_reverse_achars (Achar32* achars, int len, int pos)
{
int i;
Achar32* gs = achars + pos;
for (i = 0; i < len / 2; i++) {
Achar32 tmp = gs[i];
gs[i] = gs[len - 1 - i];
gs[len - 1 - i] = tmp;
}
}
static void bidi_reorder (REORDER_CONTEXT* context, int len,
TYPERUN **ptype_rl_list, BYTE max_level)
{
int i = 0;
TYPERUN *type_rl_list = *ptype_rl_list, *pp = NULL;
@@ -583,44 +572,82 @@ static void bidi_reorder_cb (void* context, int len,
pp1 = pp1->next;
}
pp = pp1->prev;
cb(context, len, pos);
if (context->achars) {
bidi_reverse_achars(context->achars, len, pos);
}
if (context->extra && context->cb) {
context->cb(context->extra, len, pos);
}
}
}
}
DBGLOG("\nReordering, Done\n");
}
void __mg_charset_bidi_get_embeddlevels (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
Uint8* embedding_level_list, Uint8 type)
static void bidi_reverse_chars (void* context, int len, int pos)
{
char* str = (char*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
char tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
void __mg_charset_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel, Uint8* embedding_levels, Uint8 type)
{
int i = 0;
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL, *pp;
print_hexstr(glyphs, len, FALSE);
print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, glyphs, len, &type_rl_list, &max_level);
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list,
&max_level);
/* type = 0, get the logical embedding level; else visual level.*/
for (pp = type_rl_list->next; pp->next; pp = pp->next){
int pos = POS (pp), len = LEN (pp);
for(i = 0; i < len; i++)
embedding_level_list[pos + i] = LEVEL(pp);
embedding_levels[pos + i] = LEVEL(pp);
}
if (type) {
bidi_reorder_cb(embedding_level_list, len, &type_rl_list, max_level,
bidi_index_reverse);
REORDER_CONTEXT rc;
rc.achars = NULL;
rc.extra = embedding_levels;
rc.cb = bidi_reverse_chars;
bidi_reorder(&rc, len, &type_rl_list, max_level);
}
/* free typerun list.*/
free_typerun_list(type_rl_list);
print_hexstr(glyphs, len, TRUE);
print_hexstr(achars, len, TRUE);
}
Glyph32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs,
int len, GLYPHMAPINFO* map)
#if 0
static void bidi_map_reverse (void* context, int len, int pos)
{
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
GLYPHMAPINFO tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
Achar32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
@@ -629,14 +656,12 @@ Glyph32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops, Glyph32*
int run_pos;
int run_len;
print_hexstr(glyphs, len, FALSE);
print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, glyphs, len, &type_rl_list, &max_level);
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level);
for (node_p=type_rl_list->next; node_p->next;
node_p=node_p->next)
{
for (node_p=type_rl_list->next; node_p->next; node_p=node_p->next) {
run_pos = node_p->pos;
run_len = node_p->len;
@@ -652,21 +677,21 @@ Glyph32* __mg_charset_bidi_map_reorder (const CHARSETOPS* charset_ops, Glyph32*
/* free typerun list.*/
free_typerun_list(type_rl_list);
print_hexstr(glyphs, len, TRUE);
print_hexstr(achars, len, TRUE);
return glyphs;
return achars;
}
Glyph32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs,
int len, int* index_map)
Achar32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
print_hexstr(glyphs, len, FALSE);
print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, glyphs, len, &type_rl_list, &max_level);
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level);
bidi_reorder_cb(index_map, len, &type_rl_list, max_level,
bidi_string_reverse);
@@ -674,39 +699,48 @@ Glyph32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops, Glyph32
/* free typerun list.*/
free_typerun_list(type_rl_list);
print_hexstr(glyphs, len, TRUE);
print_hexstr(achars, len, TRUE);
return glyphs;
return achars;
}
#endif
Glyph32* __mg_charset_bidi_glyphs_reorder (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len)
Achar32* __mg_charset_bidi_achars_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel,
void* extra, CB_REVERSE_EXTRA cb_reverse_extra)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
REORDER_CONTEXT rc;
print_hexstr(glyphs, len, FALSE);
print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, glyphs, len, &type_rl_list, &max_level);
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list,
&max_level);
bidi_reorder_cb (glyphs, len, &type_rl_list, max_level, bidi_string_reverse);
rc.achars = achars;
rc.extra = extra;
rc.cb = cb_reverse_extra;
bidi_reorder (&rc, len, &type_rl_list, max_level);
/* free typerun list.*/
free_typerun_list (type_rl_list);
print_hexstr (glyphs, len, TRUE);
print_hexstr (achars, len, TRUE);
return glyphs;
return achars;
}
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)
{
BYTE base_level = 0;
Uint32 base_dir = BIDI_TYPE_L;
TYPERUN *type_rl_list = NULL;
/* split the text to some runs. */
type_rl_list = get_runtype_link (charset_ops, glyphs, len);
type_rl_list = get_runtype_link (charset_ops, achars, len);
/* 1.Find base level */
bidi_resolveParagraphs(&type_rl_list, &base_dir, &base_level);
@@ -717,14 +751,3 @@ Uint32 __mg_charset_bidi_str_base_dir (const CHARSETOPS* charset_ops, Glyph32* g
return base_dir;
}
BOOL GetGlyphBIDIType (LOGFONT* log_font, Glyph32 glyph_value, Uint32 *bidi_type)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
if (mbc_devfont == NULL || mbc_devfont->charset_ops->bidi_glyph_type == NULL)
return FALSE;
*bidi_type = mbc_devfont->charset_ops->bidi_glyph_type (glyph_value);
return TRUE;
}
+912 -346
View File
File diff suppressed because it is too large Load Diff
+209 -62
View File
@@ -40,6 +40,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_ALLOCA
#include <alloca.h>
#endif
#include "common.h"
#include "minigui.h"
@@ -102,9 +105,11 @@ void font_ResetDevFont (void)
#define MATCHED_TYPE 0x01
#define MATCHED_FAMILY 0x02
#define MATCHED_CHARSET 0x04
#define MATCHED_WEIGHT 0x08
#define MATCHED_SLANT 0x10
static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
int list_len, char* req_charset)
static DEVFONT* get_matched_devfont (LOGFONT* lf, const char* family,
DEVFONT* list_head, int list_len, char* req_charset, int slot)
{
int i = 0;
BYTE* match_bits;
@@ -118,53 +123,115 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
match_bits = (BYTE *)FixStrAlloc (list_len);
#endif
_DBG_PRINTF("%s, family(%s), charset(%s), list_head(%p), list_len(%d)\n",
__FUNCTION__, family, req_charset, list_head, list_len);
i = 0;
dev_font = list_head;
while (dev_font) {
int type_req;
char family [LEN_FONT_NAME + 1];
DWORD32 style_req;
DWORD32 style_cur;
/* clear match_bits first. */
match_bits [i] = 0;
/* does match this font type? */
type_req = fontConvertFontType (log_font->type);
if (type_req == FONT_TYPE_ALL)
type_req = fontConvertFontType (lf->type);
if (type_req == FONT_TYPE_ANY) {
match_bits [i] |= MATCHED_TYPE;
else if (type_req == fontGetFontTypeFromName (dev_font->name))
_DBG_PRINTF("%s, matched type of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
else if (type_req == fontGetFontTypeFromName (dev_font->name)) {
match_bits [i] |= MATCHED_TYPE;
_DBG_PRINTF("%s, matched type of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
/* does match this family? */
fontGetFamilyFromName (dev_font->name, family);
if (strcasecmp (family, log_font->family) == 0) {
/* does match this family requested? */
if (fontDoesMatchFamily(dev_font->name, family)) {
match_bits [i] |= MATCHED_FAMILY;
_DBG_PRINTF("%s, matched family of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
/* does match this charset */
if (IsCompatibleCharset (req_charset, dev_font->charset_ops)) {
match_bits [i] |= MATCHED_CHARSET;
_DBG_PRINTF("%s, matched charset of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
/* does match the weight requested? */
style_req = lf->style & FS_WEIGHT_MASK;
style_cur = dev_font->style & FS_WEIGHT_MASK;
if (style_req == FS_WEIGHT_ANY || style_req == style_cur) {
match_bits [i] |= MATCHED_WEIGHT;
_DBG_PRINTF("%s, matched weight of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
else if (dev_font->font_ops->get_glyph_bmptype(lf, dev_font)
== DEVFONTGLYPHTYPE_MONOBMP
&& style_req > FS_WEIGHT_DEMIBOLD
&& style_cur < FS_WEIGHT_MEDIUM) {
// For mono glyph, the glyph render can do auot-bold
match_bits [i] |= MATCHED_WEIGHT;
_DBG_PRINTF("%s, matched weight (auto bold) of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
/* FIXME: ignore style */
style_req = lf->style & FS_SLANT_MASK;
style_cur = dev_font->style & FS_SLANT_MASK;
if (style_req == FS_SLANT_ANY || style_req == style_cur) {
match_bits [i] |= MATCHED_SLANT;
_DBG_PRINTF("%s, matched slant of devfont#%d(%s)\n",
__FUNCTION__, i, dev_font->name);
}
dev_font = dev_font->next;
i ++;
i++;
}
min_error = FONT_MAX_SIZE;
min_error = (FONT_MAX_SIZE << 16) + 0xFFFF;
matched_font = NULL;
dev_font = list_head;
for (i = 0; i < list_len; i++) {
int error;
if ((match_bits [i] & MATCHED_TYPE)
&& (match_bits [i] & MATCHED_FAMILY)
&& (match_bits [i] & MATCHED_CHARSET)) {
error = log_font->size -
(*dev_font->font_ops->get_font_size) (log_font, dev_font,
log_font->size);
error = ABS (error);
if (min_error >= error) { /* use >=, make the later has a higher priority */
int error, size_error, weight_error, slant_error;
size_error = lf->size -
(*dev_font->font_ops->get_font_size) (lf, dev_font,
lf->size, -1);
size_error = ABS (size_error);
if (match_bits [i] & MATCHED_WEIGHT) {
weight_error = 0;
}
else {
weight_error = (int)(lf->style & FS_WEIGHT_MASK) -
(int)(dev_font->style & FS_WEIGHT_MASK);
weight_error = ABS (weight_error);
}
if (match_bits [i] & MATCHED_SLANT) {
slant_error = 0;
}
else {
slant_error = (int)(lf->style & FS_SLANT_MASK) -
(int)(dev_font->style & FS_SLANT_MASK);
slant_error = ABS (slant_error);
}
error = (size_error << 16) + slant_error + weight_error;
_DBG_PRINTF("%s, error of devfont#%d(%s): %d\n",
__FUNCTION__, i, dev_font->name, error);
if (min_error >= error) {
/* use >=, make the later has a higher priority */
min_error = error;
matched_font = dev_font;
}
@@ -174,14 +241,61 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
}
if (matched_font) {
#ifndef HAVE_ALLOCA
FreeFixStr ((char*)match_bits);
#endif
_DBG_PRINTF("%s, got a matched devfont (%s) in the first run: %d\n",
__FUNCTION__, matched_font->name, min_error);
goto matched;
}
matched_font->font_ops->get_font_size (log_font, matched_font,
log_font->size);
min_error = (FONT_MAX_SIZE << 16) + 0xFFFF;
matched_font = NULL;
dev_font = list_head;
for (i = 0; i < list_len; i++) {
if ((match_bits [i] & MATCHED_TYPE)
&& (match_bits [i] & MATCHED_CHARSET)) {
return matched_font;
int error, size_error, weight_error, slant_error;
size_error = lf->size -
(*dev_font->font_ops->get_font_size) (lf, dev_font,
lf->size, -1);
size_error = ABS (size_error);
if (match_bits [i] & MATCHED_WEIGHT) {
weight_error = 0;
}
else {
weight_error = (int)(lf->style & FS_WEIGHT_MASK) -
(int)(dev_font->style & FS_WEIGHT_MASK);
weight_error = ABS (weight_error);
}
if (match_bits [i] & MATCHED_SLANT) {
slant_error = 0;
}
else {
slant_error = (int)(lf->style & FS_SLANT_MASK) -
(int)(dev_font->style & FS_SLANT_MASK);
slant_error = ABS (slant_error);
}
error = (size_error << 16) + slant_error + weight_error;
_DBG_PRINTF("%s, error of devfont#%d(%s): %d\n",
__FUNCTION__, i, dev_font->name, error);
if (min_error >= error) {
/* use >=, make the later has a higher priority */
min_error = error;
matched_font = dev_font;
}
}
dev_font = dev_font->next;
}
if (matched_font) {
_DBG_PRINTF("%s, got a matched devfont (%s) in the second run: %d\n",
__FUNCTION__, matched_font->name, min_error);
goto matched;
}
min_error = FONT_MAX_SIZE;
@@ -189,10 +303,12 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
for (i = 0; i < list_len; i++) {
int error;
if (match_bits [i] & MATCHED_CHARSET) {
error = log_font->size -
(*dev_font->font_ops->get_font_size) (log_font, dev_font, log_font->size);
error = lf->size -
(*dev_font->font_ops->get_font_size) (lf, dev_font,
lf->size, -1);
error = ABS (error);
if (min_error >= error) { /* use >=, make the later has a higher priority */
if (min_error >= error) {
/* use >=, make the later has a higher priority */
min_error = error;
matched_font = dev_font;
}
@@ -200,48 +316,49 @@ static DEVFONT* get_matched_devfont (LOGFONT* log_font, DEVFONT* list_head,
dev_font = dev_font->next;
}
matched:
#ifndef HAVE_ALLOCA
FreeFixStr ((char*)match_bits);
#endif
if (matched_font)
matched_font->font_ops->get_font_size (log_font, matched_font, log_font->size);
matched_font->font_ops->get_font_size (lf, matched_font,
lf->size, slot);
return matched_font;
}
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* log_font)
DEVFONT* font_GetMatchedSBDevFont (LOGFONT* lf, const char* family)
{
DEVFONT* matched_devfont;
if (GetCharsetOps (log_font->charset)->bytes_maxlen_char > 1) {
if (GetCharsetOps (lf->charset)->bytes_maxlen_char > 1) {
/*mbc logfont --- sbc devfont*/
char sysfont_charset [LEN_FONT_NAME + 1];
fontGetCharsetFromName (g_SysLogFont[0]->sbc_devfont->name, sysfont_charset);
matched_devfont = get_matched_devfont (log_font, sb_dev_font_head,
nr_sb_dev_fonts, sysfont_charset);
char sysfont_charset [LEN_LOGFONT_NAME_FIELD + 1];
fontGetCharsetFromName (g_SysLogFont[0]->devfonts[0]->name,
sysfont_charset);
matched_devfont = get_matched_devfont (lf, family, sb_dev_font_head,
nr_sb_dev_fonts, sysfont_charset, 0);
}
else {
/*sbc logfont --- sbc devfont*/
matched_devfont = get_matched_devfont (log_font, sb_dev_font_head,
nr_sb_dev_fonts,log_font->charset);
matched_devfont = get_matched_devfont (lf, family, sb_dev_font_head,
nr_sb_dev_fonts, lf->charset, 0);
}
if (!matched_devfont && g_SysLogFont [0])
matched_devfont = g_SysLogFont [0]->sbc_devfont;
return matched_devfont;
}
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* log_font)
DEVFONT* font_GetMatchedMBDevFont (LOGFONT* lf, const char* family, int slot)
{
/*sbc logfont doesn't need mbc font*/
if (GetCharsetOps (log_font->charset)->bytes_maxlen_char == 1)
if (GetCharsetOps (lf->charset)->bytes_maxlen_char == 1)
return NULL;
/*mbc logfont --- mbc devfont*/
else
return get_matched_devfont (log_font, mb_dev_font_head,
nr_mb_dev_fonts, log_font->charset);
return get_matched_devfont (lf, family, mb_dev_font_head,
nr_mb_dev_fonts, lf->charset, slot);
}
const DEVFONT* GUIAPI GetNextDevFont (const DEVFONT* dev_font)
@@ -295,9 +412,9 @@ unsigned short font_GetBestScaleFactor (int height, int expect)
{ \
devfont = head; \
while (devfont) { \
_DBG_PRINTF (" %d: %s, charsetname: %s, style: %p\n", \
_DBG_PRINTF (" %d: %s, charsetname: %s, style: %08x\n", \
count, \
devfont->name, devfont->charset_ops->name, (PVOID)devfont->style); \
devfont->name, devfont->charset_ops->name, devfont->style); \
devfont = devfont->next; \
count++; \
} \
@@ -380,12 +497,36 @@ void font_DelMBDevFont (DEVFONT* dev_font)
}
//////////////////////////////////////////////////////////////////////
static DEVFONT* find_devfont(const char* font_name, BOOL is_mbc_list)
{
DEVFONT* head;
DEVFONT* cur;
if (is_mbc_list) {
head = mb_dev_font_head;
}
else {
head = sb_dev_font_head;
}
cur = head;
while (cur) {
if (strcmp (cur->name, font_name) == 0) {
return cur;
}
cur = cur->next;
}
return NULL;
}
static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filename)
{
FONTOPS_INFO* fontops_info = __mg_fontops_infos;
DEVFONT* devfont;
CHARSETOPS* charset_ops;
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
/*find the FONTOPS and LOADER*/
while (fontops_info->type) {
@@ -411,6 +552,12 @@ static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filenam
return NULL;
}
if (find_devfont(font_name, (charset_ops->bytes_maxlen_char > 1))) {
_MG_PRINTF ("FONT>DevFont: Duplicated devfont name (%s).\n",
font_name);
return NULL;
}
devfont = calloc (1, sizeof (DEVFONT));
devfont->font_ops = fontops_info->fontops;
@@ -418,10 +565,11 @@ static DEVFONT* make_devfont (const char* font_name, void* data, BOOL is_filenam
devfont->charset_ops = charset_ops;
if (is_filename) {
devfont->data = devfont->font_ops->load_font_data (font_name, data);
devfont->data = devfont->font_ops->load_font_data (devfont,
font_name, data);
if (devfont->data == NULL) {
_MG_PRINTF ("FONT>DevFont: error in loading font %s from %s file.\n",
_MG_PRINTF ("FONT>DevFont: error in loading font %s from %s file\n",
font_name, (const char*) data);
free (devfont);
return NULL;
@@ -450,7 +598,7 @@ static void add_relating_devfonts_to_list (DEVFONT* related_devfont)
{
DEVFONT* sub_devfont;
char charset [LEN_FONT_NAME + 1];
char charset [LEN_LOGFONT_NAME_FIELD + 1];
char charsets [LEN_UNIDEVFONT_NAME + 1];
int nr_charsets;
@@ -474,7 +622,7 @@ static void add_relating_devfonts_to_list (DEVFONT* related_devfont)
}
}
BOOL AddDevFont (const char* font_name, void* data, BOOL is_filename)
static BOOL add_dev_font (const char* font_name, void* data, BOOL is_filename)
{
DEVFONT* devfont = make_devfont (font_name, data, is_filename);
if (devfont == NULL) {
@@ -575,7 +723,7 @@ BOOL font_InitIncoreFonts (void)
#ifdef _MGFONT_RBF
for (i = 0; i < NR_RBFONTS; i++) {
if (!AddDevFont (incore_rbfonts [i]->name, incore_rbfonts [i]->data, FALSE)) {
if (!add_dev_font (incore_rbfonts [i]->name, incore_rbfonts [i]->data, FALSE)) {
_MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_rbfonts [i]->name);
return FALSE;
}
@@ -584,7 +732,7 @@ BOOL font_InitIncoreFonts (void)
#ifdef _MGFONT_VBF
for (i = 0; i < NR_VBFONTS && incore_vbfonts[i]; i++) {
if (!AddDevFont (incore_vbfonts [i]->name, incore_vbfonts [i], FALSE)) {
if (!add_dev_font (incore_vbfonts [i]->name, incore_vbfonts [i], FALSE)) {
_MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", incore_vbfonts [i]->name);
return FALSE;
}
@@ -594,7 +742,7 @@ BOOL font_InitIncoreFonts (void)
#ifdef _MGFONT_UPF
for (i = 0; i < NR_UPFONTS && incore_upfonts[i]; i++) {
const char* name = ((UPFV1_FILE_HEADER*)(incore_upfonts [i]->root_dir))->font_name;
if (!AddDevFont (name, incore_upfonts [i], FALSE)) {
if (!add_dev_font (name, incore_upfonts [i], FALSE)) {
_MG_PRINTF ("FONT>DevFont: can not init incore font: %s\n", name);
return FALSE;
}
@@ -657,7 +805,7 @@ one_list:
cur = tmp->next;
if (!tmp->relationship && tmp->need_unload)
tmp->font_ops->unload_font_data (tmp->data);
tmp->font_ops->unload_font_data (tmp, tmp->data);
free (tmp);
}
@@ -673,8 +821,7 @@ one_list:
}
*/
static inline void del_devfont_from_list(const char* font_name, BOOL is_mbc_list)
static void del_devfont_from_list(const char* font_name, BOOL is_mbc_list)
{
DEVFONT* head;
DEVFONT* cur;
@@ -695,7 +842,7 @@ static inline void del_devfont_from_list(const char* font_name, BOOL is_mbc_list
if (strcmp (cur->name, font_name) == 0) {
/*unload cur->data*/
if (!cur->relationship && cur->need_unload)
cur->font_ops->unload_font_data (cur->data);
cur->font_ops->unload_font_data (cur, cur->data);
if (cur == head) {
cur = cur->next;
@@ -802,16 +949,16 @@ static BOOL init_or_term_specifical_fonts (char* etc_section, BOOL is_unload)
/*add devfont*/
if ((memres = (MEM_RES*)LoadResource (font_file, RES_TYPE_MEM_RES, 0))) {
AddDevFont (font_name, memres->data, FALSE);
add_dev_font (font_name, memres->data, FALSE);
added_num ++;
}
else {
/* [DK] Fix Bug #4801, which introduce a absolute path check error in Windows,
* first to load from sytem res path, else load it directly(relative or absolute path).*/
if ((0 == mg_path_joint(font_path, MAX_PATH + 1, sysres_get_system_res_path(), font_file))
&& ((AddDevFont (font_name, font_path, TRUE)) == TRUE))
&& ((add_dev_font (font_name, font_path, TRUE)) == TRUE))
added_num++;
else if ((AddDevFont (font_name, font_file, TRUE)) == TRUE)
else if ((add_dev_font (font_name, font_file, TRUE)) == TRUE)
added_num++;
}
}
@@ -826,12 +973,12 @@ static BOOL init_or_term_specifical_fonts (char* etc_section, BOOL is_unload)
}
}
BOOL GUIAPI font_InitSpecificalFonts (char* etc_section)
BOOL font_InitSpecificalFonts (char* etc_section)
{
return init_or_term_specifical_fonts (etc_section, FALSE);
}
void GUIAPI font_TermSpecificalFonts (char* etc_section)
void font_TermSpecificalFonts (char* etc_section)
{
init_or_term_specifical_fonts (etc_section, TRUE);
}
+40 -57
View File
@@ -58,25 +58,22 @@
#include "freetype2.h"
#endif
typedef struct _MemBlk
{
typedef struct _MemBlk {
void *data;
int len;
struct _MemBlk *hashPrev;
struct _MemBlk *hashNext;
struct _MemBlk *lruPrev;
struct _MemBlk *lruNext;
}MemBlk;
} MemBlk;
typedef MemBlk LruQueueDummyHead;
typedef MemBlk HashQueueDummyHead;
/* hash directory array in every cache */
typedef struct _HashDirectory
{
typedef struct _HashDirectory {
HashQueueDummyHead hashHead;
}HashDirectory;
} HashDirectory;
/* The structure is description of Cache
blkSize : the size of each block in cache(in byte)
@@ -88,14 +85,12 @@ typedef struct _HashDirectory
*hashDir : the hash directory pointer
lruQueueDummyHead : head node of lru queue
makeHashKeyFunc : the function which make hash key */
typedef struct cache
{
typedef struct _FontCache {
/* Information about font */
char family[LEN_FONT_NAME + 1];
char charset[LEN_FONT_NAME + 1];
DWORD style;
char df_name[LEN_UNIDEVFONT_NAME + 1];
int style;
int fontsize;
int rotation;
int refers;
int blkSize;
int nBlk;
@@ -105,7 +100,7 @@ typedef struct cache
HashDirectory *hashDir;
LruQueueDummyHead lruQueueDummyHead;
MakeHashKeyFunc makeHashKeyFunc;
}cache_t;
} FontCache;
/* Least-Recently-Used-Order
global cache LRU queue */
@@ -113,7 +108,7 @@ typedef struct _CacheQueueNode
{
/* hold global cache queue
max cache node maybe 10 */
cache_t cache;
FontCache cache;
struct _CacheQueueNode *prevCache;
struct _CacheQueueNode *nextCache;
}CacheQueueNode;
@@ -126,8 +121,7 @@ typedef struct _CacheQueueNode
cacheSize : each cache's size(in BYTE and
everyone has the same size!)
nCache : how many cache Now!! */
struct _CacheSystem
{
struct _CacheSystem {
CacheQueueNode queueDummyHead;
int maxCache;
@@ -152,7 +146,7 @@ AppendCache(CacheQueueNode *new)
/* create a new LRU-Queue. */
static int
CreateCacheLruQueue(cache_t *cache, int nblk)
CreateCacheLruQueue(FontCache *cache, int nblk)
{
int i;
MemBlk *blk;
@@ -224,7 +218,7 @@ InitCache(CacheQueueNode *new, int ndir, int nblock)
static void
LruQueueBufferSplit(cache_t *cache, int bufsize)
LruQueueBufferSplit(FontCache *cache, int bufsize)
{
MemBlk *blk;
unsigned char *buff;
@@ -239,7 +233,7 @@ LruQueueBufferSplit(cache_t *cache, int bufsize)
}
static void
DestroyCache(cache_t *cache)
DestroyCache(FontCache *cache)
{
if (cache->hashDir != NULL) {
free(cache->hashDir);
@@ -328,7 +322,7 @@ GetCache(int nblock, int ndir)
lru-queue and also Hash queue(anywhere in hash q).
Relink the lru queue and hash queue */
static MemBlk *
PickOffBlk(cache_t *cache)
PickOffBlk(FontCache *cache)
{
MemBlk *blk;
@@ -355,7 +349,7 @@ PickOffBlk(cache_t *cache)
}
static void
AppendBlk(cache_t *cache, MemBlk *blk, int key)
AppendBlk(FontCache *cache, MemBlk *blk, int key)
{
/* first, append the blcok at the end of the
lru-queue. */
@@ -384,7 +378,7 @@ AppendBlk(cache_t *cache, MemBlk *blk, int key)
*size : if found the data, how long is the data(return val)
reutrn = pointer to the data */
TTFCACHEINFO *
__mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
__mg_ttc_search(HCACHE hCache, Uchar32 unicode, int *size)
{
int key;
CacheQueueNode *ca;
@@ -402,7 +396,8 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
for ( ; blk != &(ca->cache.hashDir[key].hashHead);
blk = blk->hashNext) {
if (*(unsigned short *)(blk->data) == unicode) {
TTFCACHEINFO* tci = (TTFCACHEINFO*)blk->data;
if (tci->unicode == unicode) {
/* If found the blk, we should pick off it
and link it at the end of LRU-q */
*size = blk->len;
@@ -412,17 +407,18 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
blk->lruPrev = ca->cache.lruQueueDummyHead.lruPrev;
(ca->cache.lruQueueDummyHead.lruPrev)->lruNext = blk;
ca->cache.lruQueueDummyHead.lruPrev = blk;
return blk->data;
return tci;
}
}
return NULL;
}
/* add data into a speicial cache
/* add data into the specific cache
hCache : which cache ,
*data : your data pointer
size : your data's bytes
key : hash key of your data */
key : hash key of your data
*/
int
__mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
{
@@ -437,7 +433,7 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
if (ca->cache.blkSize < size) {
return -1;
}
key = ca->cache.makeHashKeyFunc(*(unsigned short *)data);
key = ca->cache.makeHashKeyFunc(data->unicode);
/* pick off a block from lru queue */
if ((blk = PickOffBlk(&ca->cache)) == NULL) {
@@ -460,15 +456,15 @@ __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
/* create a cache for a font instance.
nblk : how many block in the cache.
blks ize : each block's size
blksize : each block's size
ndir : how many hash entries in the cache
makeHashKey : the function which make the hash key */
HCACHE
__mg_ttc_create(char *family, char *charset, DWORD style, int size,
__mg_ttc_create(const char *df_name, int style, int size, int rotation,
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey)
{
CacheQueueNode *temp;
if (family == NULL || charset == NULL || makeHashKey == NULL) {
if (df_name == NULL || makeHashKey == NULL) {
return (HCACHE)(0);
}
if (nblk <= 0 || blksize <= 0 || size <= 0 || ndir <= 0) {
@@ -482,10 +478,11 @@ __mg_ttc_create(char *family, char *charset, DWORD style, int size,
return (HCACHE)(0);
}
strncpy(temp->cache.family, family, LEN_FONT_NAME);
strncpy(temp->cache.charset, charset, LEN_FONT_NAME);
temp->cache.style = style;
memset(temp->cache.df_name, 0, LEN_UNIDEVFONT_NAME + 1);
strncpy(temp->cache.df_name, df_name, LEN_UNIDEVFONT_NAME);
temp->cache.style = style & FS_RENDER_MASK;
temp->cache.fontsize = size;
temp->cache.rotation = rotation;
temp->cache.blkSize = blksize;
temp->cache.nBlk = nblk;
temp->cache.nDir = ndir;
@@ -573,10 +570,8 @@ __mg_ttc_sys_deinit(void)
}
}
HCACHE
__mg_ttc_is_exist(char *family, char *charset, DWORD style, int size)
__mg_ttc_is_exist(const char *df_name, int style, int size, int rotation)
{
CacheQueueNode *p;
@@ -584,28 +579,18 @@ __mg_ttc_is_exist(char *family, char *charset, DWORD style, int size)
return (HCACHE)0;
}
/* If can not match font name*/
p = __mg_globalCache.queueDummyHead.nextCache;
while (p != &__mg_globalCache.queueDummyHead) {
if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0) {
if (strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0) {
if (p->cache.fontsize == size) {
int s = style & 0x000000FF;
if ((s == FS_WEIGHT_BOOK || s == FS_WEIGHT_DEMIBOLD || s == FS_WEIGHT_SUBPIXEL) &&
(p->cache.style == FS_WEIGHT_BOOK || p->cache.style == FS_WEIGHT_DEMIBOLD ||
p->cache.style == FS_WEIGHT_SUBPIXEL)) {
if (strncmp(p->cache.df_name, df_name, LEN_UNIDEVFONT_NAME) == 0
&& p->cache.style == (style & FS_RENDER_MASK)
&& p->cache.fontsize == size
&& p->cache.rotation == rotation) {
return (HCACHE) p;
}
if ((s != FS_WEIGHT_BOOK && s != FS_WEIGHT_DEMIBOLD && s != FS_WEIGHT_SUBPIXEL) &&
(p->cache.style != FS_WEIGHT_BOOK && p->cache.style != FS_WEIGHT_DEMIBOLD &&
p->cache.style != FS_WEIGHT_SUBPIXEL)) {
return (HCACHE) p;
}
}
}
}
p = p->nextCache;
}
return (HCACHE)0;
}
@@ -658,15 +643,13 @@ void __mg_ttc_dump_all(void)
}
}
void __mg_ttc_dump(cache_t *cache)
void __mg_ttc_dump(FontCache *cache)
{
int i, j, k;
MemBlk *ptr;
#if 0
DP(("&cache = %p\n", cache));
DP(("cache.family = %s\n", cache->family));
DP(("cache.charset = %s\n", cache->charset));
DP(("cache.style = %d\n", cache->style));
DP(("cache.df_name = %s\n", cache->df_name));
DP(("cache.fontsize = %d\n", cache->fontsize));
DP(("cache.blkSize = %d\n", cache->blkSize));
DP(("cache.refers = %d\n", cache->refers));
+182 -26
View File
@@ -42,6 +42,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define DEBUG
#include "common.h"
#include "minigui.h"
@@ -70,7 +73,7 @@ int fontConvertFontType (const char* type)
if (strcasecmp (type, FONT_TYPE_NAME_SCALE_T1F) == 0)
return FONT_TYPE_SCALE_T1F;
if (strcasecmp (type, FONT_TYPE_NAME_ALL) == 0)
return FONT_TYPE_ALL;
return FONT_TYPE_ANY;
return -1;
}
@@ -96,7 +99,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type)
int fontGetFontTypeFromName (const char* name)
{
char type [LEN_FONT_NAME + 1];
char type [LEN_LOGFONT_NAME_FIELD + 1];
if (!fontGetTypeNameFromName (name, type))
return -1;
@@ -114,8 +117,8 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
if (*(++family_part) == '\0')
return FALSE;
while (family_part [i] && i <= LEN_FONT_NAME) {
if (family_part [i] == '-') {
while (family_part [i] && i <= LEN_LOGFONT_FAMILY_FILED) {
if (family_part [i] == '-'/* || family_part [i] == ',' */) {
family [i] = '\0';
break;
}
@@ -127,42 +130,155 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
return TRUE;
}
static BOOL get_family_part_lower (const char* name, char* family)
{
int i = 0;
const char* family_part;
if ((family_part = strchr (name, '-')) == NULL)
return FALSE;
if (*(++family_part) == '\0')
return FALSE;
while (family_part [i] && i <= LEN_UNIDEVFONT_NAME) {
if (family_part [i] == '-') {
family [i] = '\0';
break;
}
family [i] = tolower(family_part [i]);
i++;
}
return TRUE;
}
#if 0
static const char *my_strstr(const char *haystack, const char *needle)
{
int i = 0, j = 0;
int tmp = i;
int str_len = strlen(haystack);
int substr_len = strlen(needle);
for (i = 0; i < str_len - substr_len; i++) {
tmp = i;
for (j = 0; j < substr_len; j++) {
if (haystack[tmp] == needle[j]) {
if (j == substr_len - 1)
return haystack + i;
tmp++;
}
else
break;
}
}
return NULL;
}
#endif
/* devfont family specification:
* family[,alias]...
*/
BOOL fontDoesMatchFamily (const char* name, const char* family)
{
// make sure there is a redundant space for the head and tail characters.
char family_part[LEN_LOGFONT_FAMILY_FILED + 3];
char family_request[LEN_LOGFONT_NAME_FIELD + 3];
int i;
size_t len;
// add ',' to the head
family_part[0] = ',';
if (!get_family_part_lower(name, family_part + 1)) {
return FALSE;
}
// add ',' to the tail
len = strlen(family_part);
family_part[len] = ',';
family_part[len + 1] = '\0';
// make family (lowercase)
family_request[0] = ',';
i = 0;
while (family[i] && i < LEN_LOGFONT_NAME_FIELD) {
family_request[i + 1] = tolower(family[i]);
i++;
}
family_request[i + 1] = '\0';
// add ',' to the tail
len = strlen(family_request);
family_request[len] = ',';
family_request[len + 1] = '\0';
// try to match "<family_request>,"
if (strstr(family_part, family_request)) {
return TRUE;
}
return FALSE;
}
DWORD fontConvertStyle (const char* style_part)
{
DWORD style = 0;
style &= ~FS_WEIGHT_MASK;
switch (style_part [0]) {
case FONT_WEIGHT_BLACK:
style |= FS_WEIGHT_BLACK;
break;
case FONT_WEIGHT_EXTRA_BOLD:
style |= FS_WEIGHT_EXTRA_BOLD;
break;
case FONT_WEIGHT_BOLD:
style |= FS_WEIGHT_BOLD;
break;
/* deprecated since v3.4.0
case FONT_WEIGHT_BOOK:
style |= FS_WEIGHT_BOOK;
break;
*/
case FONT_WEIGHT_DEMIBOLD:
style |= FS_WEIGHT_DEMIBOLD;
break;
case FONT_WEIGHT_LIGHT:
style |= FS_WEIGHT_LIGHT;
break;
case FONT_WEIGHT_MEDIUM:
style |= FS_WEIGHT_MEDIUM;
break;
case FONT_WEIGHT_REGULAR:
style |= FS_WEIGHT_REGULAR;
break;
case FONT_WEIGHT_NORMAL:
style |= FS_WEIGHT_NORMAL;
break;
case FONT_WEIGHT_LIGHT:
style |= FS_WEIGHT_LIGHT;
break;
case FONT_WEIGHT_EXTRA_LIGHT:
style |= FS_WEIGHT_EXTRA_LIGHT;
break;
case FONT_WEIGHT_THIN:
style |= FS_WEIGHT_THIN;
break;
/* deprecated since v3.4.0
case FONT_WEIGHT_SUBPIXEL:
style |= FS_WEIGHT_SUBPIXEL;
break;
case FONT_WEIGHT_ALL:
style |= FS_WEIGHT_MASK;
break;
*/
case FONT_WEIGHT_ANY:
default:
return 0xFFFFFFFF;
style |= FS_WEIGHT_ANY;
break;
}
style &= ~FS_SLANT_MASK;
switch (style_part [1]) {
case FONT_SLANT_ITALIC:
style |= FS_SLANT_ITALIC;
@@ -173,13 +289,13 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_SLANT_ROMAN:
style |= FS_SLANT_ROMAN;
break;
case FONT_SLANT_ALL:
style |= FS_SLANT_MASK;
break;
case FONT_SLANT_ANY:
default:
return 0xFFFFFFFF;
style |= FS_SLANT_ANY;
break;
}
style &= ~FS_FLIP_MASK;
switch (style_part [2]) {
case FONT_FLIP_HORZ:
style |= FS_FLIP_HORZ;
@@ -191,9 +307,11 @@ DWORD fontConvertStyle (const char* style_part)
style |= FS_FLIP_HORZVERT;
break;
default:
//style |= FS_FLIP_NONE;
break;
}
style &= ~FS_OTHER_MASK;
switch (style_part [3]) {
case FONT_OTHER_AUTOSCALE:
style |= FS_OTHER_AUTOSCALE;
@@ -207,16 +325,53 @@ DWORD fontConvertStyle (const char* style_part)
case FONT_OTHER_TTFNOCACHEKERN:
style |= FS_OTHER_TTFNOCACHEKERN;
break;
case FONT_OTHER_LCDPORTRAIT:
style |= FS_OTHER_LCDPORTRAIT;
break;
case FONT_OTHER_LCDPORTRAITKERN:
style |= FS_OTHER_LCDPORTRAITKERN;
break;
default:
//style |= FS_OTHER_NONE;
break;
}
style &= ~FS_DECORATE_MASK;
switch (style_part [4]) {
case FONT_DECORATE_NONE:
break;
case FONT_DECORATE_UNDERLINE:
style |= FS_DECORATE_UNDERLINE;
break;
case FONT_DECORATE_STRUCKOUT:
style |= FS_DECORATE_STRUCKOUT;
break;
case FONT_DECORATE_REVERSE:
style |= FS_DECORATE_REVERSE;
break;
case FONT_DECORATE_OUTLINE:
style |= FS_DECORATE_OUTLINE;
break;
case FONT_DECORATE_US:
style |= FS_DECORATE_UNDERLINE;
style |= FS_DECORATE_STRUCKOUT;
break;
default:
//style |= FS_DECORATE_NONE;
break;
}
style &= ~FS_RENDER_MASK;
switch (style_part [5]) {
case FONT_RENDER_MONO:
style |= FS_RENDER_MONO;
break;
case FONT_RENDER_GREY:
style |= FS_RENDER_GREY;
break;
case FONT_RENDER_SUBPIXEL:
style |= FS_RENDER_SUBPIXEL;
break;
default:
style |= FS_RENDER_MONO;
break;
}
/* deprecated since v3.2.1
switch (style_part [4]) {
case FONT_UNDERLINE_LINE:
style |= FS_UNDERLINE_LINE;
@@ -244,6 +399,7 @@ DWORD fontConvertStyle (const char* style_part)
default:
return 0xFFFFFFFF;
}
*/
return style;
}
@@ -291,7 +447,7 @@ int fontGetWidthFromName (const char* name)
{
int i;
const char* width_part = name;
char width [LEN_FONT_NAME + 1];
char width [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_WIDTH; i++) {
if ((width_part = strchr (width_part, '-')) == NULL)
@@ -322,7 +478,7 @@ int fontGetHeightFromName (const char* name)
{
int i;
const char* height_part = name;
char height [LEN_FONT_NAME + 1];
char height [LEN_LOGFONT_NAME_FIELD + 1];
for (i = 0; i < NR_LOOP_FOR_HEIGHT; i++) {
if ((height_part = strchr (height_part, '-')) == NULL)
@@ -369,8 +525,8 @@ BOOL fontGetCharsetFromName (const char* name, char* charset)
return TRUE;
}
strncpy (charset, charset_part, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -392,8 +548,8 @@ BOOL fontGetCompatibleCharsetFromName (const char* name, char* charset)
if (*(++charset_part) == '\0')
return FALSE;
strncpy (charset, charset_part, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
@@ -451,8 +607,8 @@ BOOL charsetGetSpecificCharset (const char* charsets, int _index, char* charset)
return TRUE;
}
strncpy (charset, charsets, LEN_FONT_NAME);
charset [LEN_FONT_NAME] = '\0';
strncpy (charset, charsets, LEN_LOGFONT_NAME_FIELD);
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
return TRUE;
}
+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,
+336 -203
View File
File diff suppressed because it is too large Load Diff
+22 -18
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,
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
@@ -1,201 +0,0 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#ifndef __G_UNICODE_H__
#define __G_UNICODE_H__
/* These are the possible character classifications.
* See http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values
*/
#if 0 /* VincentWei: Moved to gid.h */
typedef enum
{
G_UNICODE_CONTROL,
G_UNICODE_FORMAT,
G_UNICODE_UNASSIGNED,
G_UNICODE_PRIVATE_USE,
G_UNICODE_SURROGATE,
G_UNICODE_LOWERCASE_LETTER,
G_UNICODE_MODIFIER_LETTER,
G_UNICODE_OTHER_LETTER,
G_UNICODE_TITLECASE_LETTER,
G_UNICODE_UPPERCASE_LETTER,
G_UNICODE_COMBINING_MARK,
G_UNICODE_ENCLOSING_MARK,
G_UNICODE_NON_SPACING_MARK,
G_UNICODE_DECIMAL_NUMBER,
G_UNICODE_LETTER_NUMBER,
G_UNICODE_OTHER_NUMBER,
G_UNICODE_CONNECT_PUNCTUATION,
G_UNICODE_DASH_PUNCTUATION,
G_UNICODE_CLOSE_PUNCTUATION,
G_UNICODE_FINAL_PUNCTUATION,
G_UNICODE_INITIAL_PUNCTUATION,
G_UNICODE_OTHER_PUNCTUATION,
G_UNICODE_OPEN_PUNCTUATION,
G_UNICODE_CURRENCY_SYMBOL,
G_UNICODE_MODIFIER_SYMBOL,
G_UNICODE_MATH_SYMBOL,
G_UNICODE_OTHER_SYMBOL,
G_UNICODE_LINE_SEPARATOR,
G_UNICODE_PARAGRAPH_SEPARATOR,
G_UNICODE_SPACE_SEPARATOR
} GUnicodeType;
#endif /* VincentWei: Moved to gid.h */
/* These are the possible line break classifications.
* Note that new types may be added in the future.
* Implementations may regard unknown values like G_UNICODE_BREAK_UNKNOWN
* See http://www.unicode.org/unicode/reports/tr14/
*/
typedef enum
{
G_UNICODE_BREAK_MANDATORY,
G_UNICODE_BREAK_CARRIAGE_RETURN,
G_UNICODE_BREAK_LINE_FEED,
G_UNICODE_BREAK_COMBINING_MARK,
G_UNICODE_BREAK_SURROGATE,
G_UNICODE_BREAK_ZERO_WIDTH_SPACE,
G_UNICODE_BREAK_INSEPARABLE,
G_UNICODE_BREAK_NON_BREAKING_GLUE,
G_UNICODE_BREAK_CONTINGENT,
G_UNICODE_BREAK_SPACE,
G_UNICODE_BREAK_AFTER,
G_UNICODE_BREAK_BEFORE,
G_UNICODE_BREAK_BEFORE_AND_AFTER,
G_UNICODE_BREAK_HYPHEN,
G_UNICODE_BREAK_NON_STARTER,
G_UNICODE_BREAK_OPEN_PUNCTUATION,
G_UNICODE_BREAK_CLOSE_PUNCTUATION,
G_UNICODE_BREAK_QUOTATION,
G_UNICODE_BREAK_EXCLAMATION,
G_UNICODE_BREAK_IDEOGRAPHIC,
G_UNICODE_BREAK_NUMERIC,
G_UNICODE_BREAK_INFIX_SEPARATOR,
G_UNICODE_BREAK_SYMBOL,
G_UNICODE_BREAK_ALPHABETIC,
G_UNICODE_BREAK_PREFIX,
G_UNICODE_BREAK_POSTFIX,
G_UNICODE_BREAK_COMPLEX_CONTEXT,
G_UNICODE_BREAK_AMBIGUOUS,
G_UNICODE_BREAK_UNKNOWN,
G_UNICODE_BREAK_NEXT_LINE,
G_UNICODE_BREAK_WORD_JOINER,
G_UNICODE_BREAK_HANGUL_L_JAMO,
G_UNICODE_BREAK_HANGUL_V_JAMO,
G_UNICODE_BREAK_HANGUL_T_JAMO,
G_UNICODE_BREAK_HANGUL_LV_SYLLABLE,
G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
} GUnicodeBreakType;
typedef enum
{ /* ISO 15924 code */
G_UNICODE_SCRIPT_INVALID_CODE = -1,
G_UNICODE_SCRIPT_COMMON = 0, /* Zyyy */
G_UNICODE_SCRIPT_INHERITED, /* Qaai */
G_UNICODE_SCRIPT_ARABIC, /* Arab */
G_UNICODE_SCRIPT_ARMENIAN, /* Armn */
G_UNICODE_SCRIPT_BENGALI, /* Beng */
G_UNICODE_SCRIPT_BOPOMOFO, /* Bopo */
G_UNICODE_SCRIPT_CHEROKEE, /* Cher */
G_UNICODE_SCRIPT_COPTIC, /* Qaac */
G_UNICODE_SCRIPT_CYRILLIC, /* Cyrl (Cyrs) */
G_UNICODE_SCRIPT_DESERET, /* Dsrt */
G_UNICODE_SCRIPT_DEVANAGARI, /* Deva */
G_UNICODE_SCRIPT_ETHIOPIC, /* Ethi */
G_UNICODE_SCRIPT_GEORGIAN, /* Geor (Geon, Geoa) */
G_UNICODE_SCRIPT_GOTHIC, /* Goth */
G_UNICODE_SCRIPT_GREEK, /* Grek */
G_UNICODE_SCRIPT_GUJARATI, /* Gujr */
G_UNICODE_SCRIPT_GURMUKHI, /* Guru */
G_UNICODE_SCRIPT_HAN, /* Hani */
G_UNICODE_SCRIPT_HANGUL, /* Hang */
G_UNICODE_SCRIPT_HEBREW, /* Hebr */
G_UNICODE_SCRIPT_HIRAGANA, /* Hira */
G_UNICODE_SCRIPT_KANNADA, /* Knda */
G_UNICODE_SCRIPT_KATAKANA, /* Kana */
G_UNICODE_SCRIPT_KHMER, /* Khmr */
G_UNICODE_SCRIPT_LAO, /* Laoo */
G_UNICODE_SCRIPT_LATIN, /* Latn (Latf, Latg) */
G_UNICODE_SCRIPT_MALAYALAM, /* Mlym */
G_UNICODE_SCRIPT_MONGOLIAN, /* Mong */
G_UNICODE_SCRIPT_MYANMAR, /* Mymr */
G_UNICODE_SCRIPT_OGHAM, /* Ogam */
G_UNICODE_SCRIPT_OLD_ITALIC, /* Ital */
G_UNICODE_SCRIPT_ORIYA, /* Orya */
G_UNICODE_SCRIPT_RUNIC, /* Runr */
G_UNICODE_SCRIPT_SINHALA, /* Sinh */
G_UNICODE_SCRIPT_SYRIAC, /* Syrc (Syrj, Syrn, Syre) */
G_UNICODE_SCRIPT_TAMIL, /* Taml */
G_UNICODE_SCRIPT_TELUGU, /* Telu */
G_UNICODE_SCRIPT_THAANA, /* Thaa */
G_UNICODE_SCRIPT_THAI, /* Thai */
G_UNICODE_SCRIPT_TIBETAN, /* Tibt */
G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, /* Cans */
G_UNICODE_SCRIPT_YI, /* Yiii */
G_UNICODE_SCRIPT_TAGALOG, /* Tglg */
G_UNICODE_SCRIPT_HANUNOO, /* Hano */
G_UNICODE_SCRIPT_BUHID, /* Buhd */
G_UNICODE_SCRIPT_TAGBANWA, /* Tagb */
/* Unicode-4.0 additions */
G_UNICODE_SCRIPT_BRAILLE, /* Brai */
G_UNICODE_SCRIPT_CYPRIOT, /* Cprt */
G_UNICODE_SCRIPT_LIMBU, /* Limb */
G_UNICODE_SCRIPT_OSMANYA, /* Osma */
G_UNICODE_SCRIPT_SHAVIAN, /* Shaw */
G_UNICODE_SCRIPT_LINEAR_B, /* Linb */
G_UNICODE_SCRIPT_TAI_LE, /* Tale */
G_UNICODE_SCRIPT_UGARITIC, /* Ugar */
/* Unicode-4.1 additions */
G_UNICODE_SCRIPT_NEW_TAI_LUE, /* Talu */
G_UNICODE_SCRIPT_BUGINESE, /* Bugi */
G_UNICODE_SCRIPT_GLAGOLITIC, /* Glag */
G_UNICODE_SCRIPT_TIFINAGH, /* Tfng */
G_UNICODE_SCRIPT_SYLOTI_NAGRI, /* Sylo */
G_UNICODE_SCRIPT_OLD_PERSIAN, /* Xpeo */
G_UNICODE_SCRIPT_KHAROSHTHI, /* Khar */
/* Unicode-5.0 additions */
G_UNICODE_SCRIPT_UNKNOWN, /* Zzzz */
G_UNICODE_SCRIPT_BALINESE, /* Bali */
G_UNICODE_SCRIPT_CUNEIFORM, /* Xsux */
G_UNICODE_SCRIPT_PHOENICIAN, /* Phnx */
G_UNICODE_SCRIPT_PHAGS_PA, /* Phag */
G_UNICODE_SCRIPT_NKO /* Nkoo */
} GUnicodeScript;
#endif /* __G_UNICODE_H__ */
+217
View File
@@ -0,0 +1,217 @@
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/en/about/licensing-policy/>.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#ifdef _MGCHARSET_UNICODE
static const Uint16 iso639_1_codes[] =
{
#define PACK(a,b) ((Uint16)((((Uint8)(a))<<8)|((Uint8)(b))))
PACK('a', 'a'), // Afar
PACK('a', 'b'), // Abkhazian
PACK('a', 'f'), // Afrikaans
PACK('a', 'm'), // Amharic
PACK('a', 'r'), // Arabic
PACK('a', 's'), // Assamese
PACK('a', 'y'), // Aymara
PACK('a', 'z'), // Azerbaijani
PACK('b', 'a'), // Bashkir
PACK('b', 'e'), // Byelorussian
PACK('b', 'g'), // Bulgarian
PACK('b', 'h'), // Bihari
PACK('b', 'i'), // Bislama
PACK('b', 'n'), // Bengali
PACK('b', 'o'), // Tibetan
PACK('b', 'r'), // Breton
PACK('c', 'a'), // Catalan
PACK('c', 'o'), // Corsican
PACK('c', 's'), // Czech
PACK('c', 'y'), // Welch
PACK('d', 'a'), // Danish
PACK('d', 'e'), // German
PACK('d', 'z'), // Bhutani
PACK('e', 'l'), // Greek
PACK('e', 'n'), // English
PACK('e', 'o'), // Esperanto
PACK('e', 's'), // Spanish
PACK('e', 't'), // Estonian
PACK('e', 'u'), // Basque
PACK('f', 'a'), // Persian
PACK('f', 'i'), // Finnish
PACK('f', 'j'), // Fiji
PACK('f', 'o'), // Faeroese
PACK('f', 'r'), // French
PACK('f', 'y'), // Frisian
PACK('g', 'a'), // Irish
PACK('g', 'd'), // Scots Gaelic
PACK('g', 'l'), // Galician
PACK('g', 'n'), // Guarani
PACK('g', 'u'), // Gujarati
PACK('h', 'a'), // Hausa
PACK('h', 'i'), // Hindi
PACK('h', 'e'), // Hebrew
PACK('h', 'r'), // Croatian
PACK('h', 'u'), // Hungarian
PACK('h', 'y'), // Armenian
PACK('i', 'a'), // Interlingua
PACK('i', 'd'), // Indonesian
PACK('i', 'e'), // Interlingue
PACK('i', 'k'), // Inupiak
PACK('i', 'n'), // former Indonesian
PACK('i', 's'), // Icelandic
PACK('i', 't'), // Italian
PACK('i', 'u'), // Inuktitut (Eskimo)
PACK('i', 'w'), // former Hebrew
PACK('j', 'a'), // Japanese
PACK('j', 'i'), // former Yiddish
PACK('j', 'w'), // Javanese
PACK('k', 'a'), // Georgian
PACK('k', 'k'), // Kazakh
PACK('k', 'l'), // Greenlandic
PACK('k', 'm'), // Cambodian
PACK('k', 'n'), // Kannada
PACK('k', 'o'), // Korean
PACK('k', 's'), // Kashmiri
PACK('k', 'u'), // Kurdish
PACK('k', 'y'), // Kirghiz
PACK('l', 'a'), // Latin
PACK('l', 'n'), // Lingala
PACK('l', 'o'), // Laothian
PACK('l', 't'), // Lithuanian
PACK('l', 'v'), // Latvian, Lettish
PACK('m', 'g'), // Malagasy
PACK('m', 'i'), // Maori
PACK('m', 'k'), // Macedonian
PACK('m', 'l'), // Malayalam
PACK('m', 'n'), // Mongolian
PACK('m', 'o'), // Moldavian
PACK('m', 'r'), // Marathi
PACK('m', 's'), // Malay
PACK('m', 't'), // Maltese
PACK('m', 'y'), // Burmese
PACK('n', 'a'), // Nauru
PACK('n', 'e'), // Nepali
PACK('n', 'l'), // Dutch
PACK('n', 'o'), // Norwegian
PACK('o', 'c'), // Occitan
PACK('o', 'm'), // (Afan) Oromo
PACK('o', 'r'), // Oriya
PACK('p', 'a'), // Punjabi
PACK('p', 'l'), // Polish
PACK('p', 's'), // Pashto, Pushto
PACK('p', 't'), // Portuguese
PACK('q', 'u'), // Quechua
PACK('r', 'm'), // Rhaeto-Romance
PACK('r', 'n'), // Kirundi
PACK('r', 'o'), // Romanian
PACK('r', 'u'), // Russian
PACK('r', 'w'), // Kinyarwanda
PACK('s', 'a'), // Sanskrit
PACK('s', 'd'), // Sindhi
PACK('s', 'g'), // Sangro
PACK('s', 'h'), // Serbo-Croatian
PACK('s', 'i'), // Singhalese
PACK('s', 'k'), // Slovak
PACK('s', 'l'), // Slovenian
PACK('s', 'm'), // Samoan
PACK('s', 'n'), // Shona
PACK('s', 'o'), // Somali
PACK('s', 'q'), // Albanian
PACK('s', 'r'), // Serbian
PACK('s', 's'), // Siswati
PACK('s', 't'), // Sesotho
PACK('s', 'u'), // Sudanese
PACK('s', 'v'), // Swedish
PACK('s', 'w'), // Swahili
PACK('t', 'a'), // Tamil
PACK('t', 'e'), // Tegulu
PACK('t', 'g'), // Tajik
PACK('t', 'h'), // Thai
PACK('t', 'i'), // Tigrinya
PACK('t', 'k'), // Turkmen
PACK('t', 'l'), // Tagalog
PACK('t', 'n'), // Setswana
PACK('t', 'o'), // Tonga
PACK('t', 'r'), // Turkish
PACK('t', 's'), // Tsonga
PACK('t', 't'), // Tatar
PACK('t', 'w'), // Twi
PACK('u', 'g'), // Uigur
PACK('u', 'k'), // Ukrainian
PACK('u', 'r'), // Urdu
PACK('u', 'z'), // Uzbek
PACK('v', 'i'), // Vietnamese
PACK('v', 'o'), // Volapuk
PACK('w', 'o'), // Wolof
PACK('x', 'h'), // Xhosa
PACK('y', 'i'), // Yiddish
PACK('y', 'o'), // Yoruba
PACK('z', 'a'), // Zhuang
PACK('z', 'h'), // Chinese
PACK('z', 'u'), // Zulu
#undef PACK
};
int GUIAPI LanguageCodeFromISO639s1 (Uint16 iso639_1)
{
unsigned int lower = 0;
unsigned int upper = TABLESIZE (iso639_1_codes) - 1;
unsigned int mid = TABLESIZE (iso639_1_codes) / 2;
if (!iso639_1)
return LANGCODE_unknown;
do {
if (iso639_1 < iso639_1_codes[mid])
upper = mid - 1;
else if (iso639_1 > iso639_1_codes[mid])
lower = mid + 1;
else
return (int)mid;
mid = (lower + upper) / 2;
} while (lower <= upper);
return LANGCODE_unknown;
}
#endif /* _MGCHARSET_UNICODE */
+382 -321
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,
+11 -11
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,25 +205,25 @@ 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);
@@ -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
@@ -50,8 +50,8 @@
int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
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 count = 0;
int left_bytes = len;
int len_cur_char;
@@ -86,8 +86,8 @@ int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
int* pos_words, WORDINFO* info_words)
{
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];
WORDINFO word_info;
int count = 0;
int left_bytes = len;
@@ -150,8 +150,8 @@ int GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len)
{
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 = 0;
if (mbc_devfont) {
@@ -171,8 +171,8 @@ int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len)
int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len)
{
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 left_bytes = len;
int len_cur_char;
int lastlen = 0;
@@ -204,8 +204,8 @@ int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len)
int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
WORDINFO* word_info)
{
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];
if (mbc_devfont) {
int mbc_pos;
@@ -234,12 +234,12 @@ int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
const unsigned char* mchar, int n)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
DEVFONT* sbc_devfont = log_font->devfonts[0];
DEVFONT* devfont;
int len_cur_char = 0;
Glyph32 glyph_value;
UChar32 uc32;
Uchar32 uc32;
if (mbc_devfont) {
len_cur_char = mbc_devfont->charset_ops->len_first_char (mchar, n);
@@ -256,22 +256,22 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
return 0;
else {
if (dest) {
glyph_value = devfont->charset_ops->char_glyph_value(NULL, 0, mchar, n);
glyph_value = devfont->charset_ops->get_char_value(NULL, 0, mchar, n);
if(devfont->charset_ops->conv_to_uc32)
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
else
uc32 = glyph_value;
if (wc32) {
UChar32* uchar32 = (UChar32*)dest;
Uchar32* uchar32 = (Uchar32*)dest;
*uchar32 = uc32;
}
else {
UChar16* uchar16 = (UChar16*)dest;
Uchar16* uchar16 = (Uchar16*)dest;
if (uc32 > 0xFFFF)
*uchar16 = 0xFEFF;
else
*uchar16 = (UChar16)uc32;
*uchar16 = (Uchar16)uc32;
}
}
return len_cur_char;
@@ -280,10 +280,10 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
return -1;
}
int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, UChar32 wc)
int GUIAPI WC2MBEx (PLOGFONT log_font, unsigned char *s, Uchar32 wc)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
DEVFONT* sbc_devfont = log_font->devfonts[0];
unsigned char mchar [16];
int len_cur_char = 0;
@@ -311,14 +311,14 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
const unsigned char* mstr, int mstr_len, int n,
int* conved_mstr_len)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
DEVFONT* sbc_devfont = log_font->devfonts[0];
DEVFONT* devfont;
int left, count = 0;
UChar32* uchar32;
UChar16* uchar16;
Uchar32* uchar32;
Uchar16* uchar16;
Glyph32 glyph_value;
UChar32 uc32;
Uchar32 uc32;
if (conved_mstr_len)
*conved_mstr_len = 0;
@@ -328,10 +328,10 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
if (wc32) {
uchar16 = NULL;
uchar32 = (UChar32*)dest;
uchar32 = (Uchar32*)dest;
}
else {
uchar16 = (UChar16*)dest;
uchar16 = (Uchar16*)dest;
uchar32 = NULL;
}
@@ -371,7 +371,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
}
}
else {
glyph_value = devfont->charset_ops->char_glyph_value (NULL, 0, mstr, left);
glyph_value = devfont->charset_ops->get_char_value (NULL, 0, mstr, left);
if (devfont->charset_ops->conv_to_uc32)
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
else
@@ -384,7 +384,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
if (uc32 > 0xFFFF)
uchar16 [count] = 0xFEFF;
else
uchar16 [count] = (UChar16)uc32;
uchar16 [count] = (Uchar16)uc32;
}
count++;
@@ -406,13 +406,13 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
const void *wcs, int wcs_len, BOOL wc32, int n,
int* conved_wcs_len)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* sbc_devfont = log_font->sbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
DEVFONT* sbc_devfont = log_font->devfonts[0];
int wc_count = 0, count = 0;
unsigned char mchar [16] = {0};
const UChar32* uchar32;
const UChar16* uchar16;
UChar32 uc32;
const Uchar32* uchar32;
const Uchar16* uchar16;
Uchar32 uc32;
if (conved_wcs_len)
*conved_wcs_len = 0;
@@ -422,10 +422,10 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
if (wc32) {
uchar16 = NULL;
uchar32 = (UChar32*)wcs;
uchar32 = (Uchar32*)wcs;
}
else {
uchar16 = (UChar16*)wcs;
uchar16 = (Uchar16*)wcs;
uchar32 = NULL;
}
@@ -493,7 +493,7 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
size_t __mg_strlen (PLOGFONT log_font, const char* mstr)
{
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
size_t len = 0;
@@ -514,7 +514,7 @@ char* __mg_strnchr (PLOGFONT log_font, const char* s, size_t n, int c,
{
size_t i;
unsigned char c1, c2;
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
if (mbc_devfont) {
*chlen = 2;
@@ -566,7 +566,7 @@ int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
len = substr - text;
if (*nr_delim == 2) {
DEVFONT* mbc_devfont = log_font->mbc_devfont;
DEVFONT* mbc_devfont = log_font->devfonts[1];
unsigned char c1, c2;
if (strstr (mbc_devfont->charset_ops->name, "UTF-16LE")) {
+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;

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