mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 09:14:09 +08:00
Compare commits
155
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4b18828b2 | ||
|
|
36167be7e6 | ||
|
|
4b633c801d | ||
|
|
33fd8a8668 | ||
|
|
94f44890a5 | ||
|
|
cc7441c4dd | ||
|
|
6fdc0281ba | ||
|
|
136a51d9b8 | ||
|
|
5e871c486b | ||
|
|
fdd69bf470 | ||
|
|
10e55b0d4f | ||
|
|
682c81d636 | ||
|
|
9eb4e54b75 | ||
|
|
e43bc07a63 | ||
|
|
508130afdc | ||
|
|
d60c057dc4 | ||
|
|
8f5a741af6 | ||
|
|
bee1bc87c4 | ||
|
|
3a9274e9a0 | ||
|
|
44ee735cd6 | ||
|
|
2c010cdbeb | ||
|
|
a04ae43bdb | ||
|
|
5c333445c5 | ||
|
|
dd93e67a3d | ||
|
|
d886268eee | ||
|
|
090824cb91 | ||
|
|
00eb4e363f | ||
|
|
f73f0786ee | ||
|
|
dacc81cf2a | ||
|
|
97c6249af5 | ||
|
|
7ce1fe47ff | ||
|
|
8e66bb366e | ||
|
|
ce7fd6e776 | ||
|
|
957f9cbb47 | ||
|
|
2a7e3003bd | ||
|
|
19cd208a6e | ||
|
|
6a44111a35 | ||
|
|
fd5d55942b | ||
|
|
d4e7f048f0 | ||
|
|
d90c4d5842 | ||
|
|
0f562cd39f | ||
|
|
fb01003c45 | ||
|
|
9bcea02975 | ||
|
|
c51ae8d1c1 | ||
|
|
b8a5ad2d73 | ||
|
|
39b8c88d1b | ||
|
|
1e73f6713a | ||
|
|
97babaa4e2 | ||
|
|
c6c486f306 | ||
|
|
338f10b896 | ||
|
|
2353a873a8 | ||
|
|
52c539e870 | ||
|
|
64d63a84c5 | ||
|
|
3d80d73450 | ||
|
|
2e04898fbe | ||
|
|
f390e1a091 | ||
|
|
848c1d7ce1 | ||
|
|
0c0becc780 | ||
|
|
0e918da2a4 | ||
|
|
7f36c339b7 | ||
|
|
871486daab | ||
|
|
0cffc8798f | ||
|
|
4d4a3901eb | ||
|
|
50e95cb461 | ||
|
|
d223edf0ba | ||
|
|
8e88082f07 | ||
|
|
5b1762b637 | ||
|
|
6c83ea4ceb | ||
|
|
5aa5e75813 | ||
|
|
1ba35dcbf6 | ||
|
|
8828824b23 | ||
|
|
e3f2cc22ec | ||
|
|
93aae6782e | ||
|
|
b746d2927e | ||
|
|
79e3be705c | ||
|
|
a052b7bf55 | ||
|
|
74a84362ca | ||
|
|
d673008f5a | ||
|
|
09c9438de8 | ||
|
|
0734180d70 | ||
|
|
8ca8deb02d | ||
|
|
9aa719aeb3 | ||
|
|
447eebbafc | ||
|
|
19f8689a20 | ||
|
|
60902f83d5 | ||
|
|
a725acfd5e | ||
|
|
0191772111 | ||
|
|
a11cef5f2e | ||
|
|
cf4c75bcbc | ||
|
|
f85801dcbe | ||
|
|
4e67f8c56b | ||
|
|
1cfd2fe324 | ||
|
|
5ef2e0fa42 | ||
|
|
57b71e985c | ||
|
|
d9d76ec59b | ||
|
|
7935883267 | ||
|
|
0385def7b2 | ||
|
|
565f4b34e5 | ||
|
|
70ba8a0420 | ||
|
|
4bdbe4a002 | ||
|
|
2c98ef96da | ||
|
|
6663c98787 | ||
|
|
bbf2376f7a | ||
|
|
21ac9f2def | ||
|
|
a10d28dd11 | ||
|
|
856126c72e | ||
|
|
547fc0059c | ||
|
|
195363dc82 | ||
|
|
54288e5687 | ||
|
|
9d46406a95 | ||
|
|
d365feca5d | ||
|
|
f34ac9d0fe | ||
|
|
3a02b056ca | ||
|
|
1a1e8cf652 | ||
|
|
94feb0ae44 | ||
|
|
1e1a5edd13 | ||
|
|
ae9b14201b | ||
|
|
742150d4f1 | ||
|
|
03eac03c8c | ||
|
|
8cd6b037ec | ||
|
|
b35e38bdff | ||
|
|
58275c88e9 | ||
|
|
31b43521d0 | ||
|
|
e68ee00b85 | ||
|
|
6e54d4a7d7 | ||
|
|
69b1d63569 | ||
|
|
817f4063a1 | ||
|
|
c9ec23dc70 | ||
|
|
972085fa56 | ||
|
|
c2e24b61e3 | ||
|
|
bd1fb67930 | ||
|
|
0fcedfca08 | ||
|
|
c39ce7c0b8 | ||
|
|
97014ccdc8 | ||
|
|
48e7f6e928 | ||
|
|
473f9f98ff | ||
|
|
95d09a7673 | ||
|
|
53253ed101 | ||
|
|
4bd7c0eef4 | ||
|
|
9af71438dd | ||
|
|
82033a44dd | ||
|
|
1c9537fc63 | ||
|
|
612c395c06 | ||
|
|
8dc0ee2ade | ||
|
|
caefd7355a | ||
|
|
9ea0e15dba | ||
|
|
83c8984c74 | ||
|
|
4761333a1a | ||
|
|
8538f29f70 | ||
|
|
b658413961 | ||
|
|
bb187f1ee3 | ||
|
|
ea8ab93bad | ||
|
|
9226fcff26 | ||
|
|
05cf370155 | ||
|
|
0d2352884a |
+16
@@ -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
|
||||||
@@ -3216,7 +3216,7 @@ alExtra.(xwyan)
|
|||||||
* src/gui/lf_flat.c
|
* src/gui/lf_flat.c
|
||||||
* src/gui/lf_skin.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.
|
the glyph type the devfont can give us.
|
||||||
* src/include/devfont.h
|
* src/include/devfont.h
|
||||||
* src/font/*.c
|
* src/font/*.c
|
||||||
@@ -4761,7 +4761,7 @@ create_skin_main_window_ex:
|
|||||||
* ext/skin/skin.c
|
* ext/skin/skin.c
|
||||||
|
|
||||||
05/16. ENHANCEMENT #8: Support for UTF-16LE and UTF-16BE charsets/encodings.
|
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
|
* include/gdi.h
|
||||||
|
|
||||||
05/16. ENHANCEMENT #11: Support for FreeType2.
|
05/16. ENHANCEMENT #11: Support for FreeType2.
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = "MiniGUI API Reference (MiniGUI-Standalone)"
|
|||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
# control system is used.
|
# 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
|
# 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
|
# for a project that appears at the top of each page and should give viewer a
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
|||||||
|
|
||||||
1. Introduction
|
1. Introduction
|
||||||
1. A brief building instruction
|
1. A brief building instruction
|
||||||
|
1. New features in version 3.4.x
|
||||||
1. New features in version 3.2.x
|
1. New features in version 3.2.x
|
||||||
1. The runtime modes of MiniGUI
|
1. The runtime modes of MiniGUI
|
||||||
1. History
|
1. History
|
||||||
@@ -146,6 +147,15 @@ For more information, please run
|
|||||||
$ ./configure --help
|
$ ./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
|
## NEW FEATURES IN VERSION 3.2.x
|
||||||
|
|
||||||
We introduce some new features in MiniGUI Version 3.2.x:
|
We introduce some new features in MiniGUI Version 3.2.x:
|
||||||
@@ -202,7 +212,7 @@ clients and the server.
|
|||||||
|
|
||||||
## HISTORY
|
## 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.
|
the end of 1998, and now it becomes much reliable and stable.
|
||||||
During the past years, many remarkable changes have taken place in
|
During the past years, many remarkable changes have taken place in
|
||||||
the MiniGUI project.
|
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.
|
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.
|
46) Dec., 2017: FMSoft updated MiniGUI and miniStudio for latest Linux distributions.
|
||||||
47) Feb., 2018: FMSoft released MiniGUI version 3.2.
|
47) Feb., 2018: FMSoft released MiniGUI version 3.2.
|
||||||
|
47) Jun., 2019: FMSoft released MiniGUI version 3.4.
|
||||||
|
|
||||||
|
|
||||||
## ABOUT THE AUTHORS
|
## ABOUT THE AUTHORS
|
||||||
|
|||||||
+138
-4
@@ -1,8 +1,142 @@
|
|||||||
# Release Notes
|
# 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.
|
All users of MiniGUI are recommended strongly to use this version.
|
||||||
Please report any bugs and incompatibilities in
|
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
|
1. New API: `UpdateInvalidClient`. You can use this function to update
|
||||||
the invalid client region of a window instantly.
|
the invalid client region of a window instantly.
|
||||||
1. Use different colors for the output of `_DBG_PRINTF` and `_ERR_PRINTF`.
|
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. Add `__mg_save_jpg` function for storing MYBITMAP as JPEG file (@10km).
|
||||||
1. Modified logic for checking JPEG format (10km).
|
1. Modified logic for checking JPEG format (@10km).
|
||||||
1. Support BIDI for UNICODE charsets and cleanup the implementation.
|
1. Support BIDI for UNICODE charsets and cleanup the implementation.
|
||||||
* New API: `GetGlyphBIDIType` to get the glyph type in BIDI.
|
* New API: `GetGlyphBIDIType` to get the glyph type in BIDI.
|
||||||
* New DC attribute: BIDI flag.
|
* New DC attribute: BIDI flag.
|
||||||
|
|||||||
@@ -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:
|
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:
|
The latest samples package is:
|
||||||
|
|
||||||
* mg-samples-3.2.0.tar.gz
|
* mg-samples-3.4.0.tar.gz
|
||||||
|
|||||||
+36
-25
@@ -1,6 +1,6 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_INIT(libminigui, 3.2.2)
|
AC_INIT(libminigui, 3.4.0)
|
||||||
AC_CONFIG_SRCDIR(src/main/main.c)
|
AC_CONFIG_SRCDIR(src/main/main.c)
|
||||||
|
|
||||||
dnl Set various version strings - taken gratefully from the SDL sources
|
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.
|
# set MINIGUI_BINARY_AGE and MINIGUI_INTERFACE_AGE to 0.
|
||||||
#
|
#
|
||||||
MINIGUI_MAJOR_VERSION=3
|
MINIGUI_MAJOR_VERSION=3
|
||||||
MINIGUI_MINOR_VERSION=2
|
MINIGUI_MINOR_VERSION=4
|
||||||
MINIGUI_MICRO_VERSION=2
|
MINIGUI_MICRO_VERSION=0
|
||||||
MINIGUI_INTERFACE_AGE=0
|
MINIGUI_INTERFACE_AGE=0
|
||||||
MINIGUI_BINARY_AGE=1
|
MINIGUI_BINARY_AGE=0
|
||||||
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
|
||||||
|
|
||||||
AC_SUBST(MINIGUI_MAJOR_VERSION)
|
AC_SUBST(MINIGUI_MAJOR_VERSION)
|
||||||
@@ -537,7 +537,7 @@ AC_ARG_ENABLE(sefsupport,
|
|||||||
build_sef_support=$enableval)
|
build_sef_support=$enableval)
|
||||||
|
|
||||||
AC_ARG_WITH(ttfsupport,
|
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)
|
use_ttf_lib=$withval)
|
||||||
|
|
||||||
AC_ARG_ENABLE(ttfcache,
|
AC_ARG_ENABLE(ttfcache,
|
||||||
@@ -1978,17 +1978,20 @@ fi
|
|||||||
|
|
||||||
dnl Check FreeType lib
|
dnl Check FreeType lib
|
||||||
case "$use_ttf_lib" in
|
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)
|
ft1)
|
||||||
dnl Check for FreeType1 library
|
dnl Check for FreeType1 library
|
||||||
AC_CHECK_LIB(ttf, TT_FreeType_Version,
|
AC_CHECK_LIB(ttf, TT_FreeType_Version,
|
||||||
DEP_LIBS="$DEP_LIBS -lttf",
|
DEP_LIBS="$DEP_LIBS -lttf",
|
||||||
use_ttf_lib="none")
|
use_ttf_lib="none")
|
||||||
;;
|
;;
|
||||||
ft2)
|
*)
|
||||||
dnl Check for FreeType2 library
|
use_ttf_lib="none"
|
||||||
AC_CHECK_LIB(freetype, FT_Library_Version,
|
|
||||||
DEP_LIBS="$DEP_LIBS -lfreetype",
|
|
||||||
use_ttf_lib="none")
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -2000,7 +2003,7 @@ case "$use_ttf_lib" in
|
|||||||
[Define if include ttf cache])
|
[Define if include ttf cache])
|
||||||
|
|
||||||
AC_ARG_WITH(ttfcachesize,
|
AC_ARG_WITH(ttfcachesize,
|
||||||
[ --with-ttfcachesize=[64/128/256/512/1024]])
|
[ --with-ttfcachesize=[64/128/256/512/1024/2048]])
|
||||||
|
|
||||||
case "$with_ttfcachesize" in
|
case "$with_ttfcachesize" in
|
||||||
64)
|
64)
|
||||||
@@ -2023,30 +2026,38 @@ case "$use_ttf_lib" in
|
|||||||
AC_DEFINE(_MGTTF_CACHE_SIZE, 1024,
|
AC_DEFINE(_MGTTF_CACHE_SIZE, 1024,
|
||||||
[Define if compile max ttf cahce size for 1024k])
|
[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,
|
AC_DEFINE(_MGTTF_CACHE_SIZE, 1024,
|
||||||
[Define if compile max ttf cahce size for 256k])
|
[Define if compile max ttf cahce size for 1024k (default value)])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_ARG_WITH(ttfcachenum,
|
AC_ARG_WITH(ttfcachenum,
|
||||||
[ --with-mttfcachenum=[10/20/40]])
|
[ --with-mttfcachenum=[16/32/64/128]])
|
||||||
case "$with_mttfcachenum" in
|
case "$with_mttfcachenum" in
|
||||||
10)
|
16)
|
||||||
AC_DEFINE(_MGMAX_TTF_CACHE, 10,
|
AC_DEFINE(_MGMAX_TTF_CACHE, 16,
|
||||||
[Define if compile max ttf cahce number for 10])
|
[Define if compile max ttf cahce number for 16])
|
||||||
;;
|
;;
|
||||||
20)
|
32)
|
||||||
AC_DEFINE(_MGMAX_TTF_CACHE, 20,
|
AC_DEFINE(_MGMAX_TTF_CACHE, 32,
|
||||||
[Define if compile max ttf cahce number for 20])
|
[Define if compile max ttf cahce number for 32])
|
||||||
;;
|
;;
|
||||||
40)
|
64)
|
||||||
AC_DEFINE(_MGMAX_TTF_CACHE, 40,
|
AC_DEFINE(_MGMAX_TTF_CACHE, 64,
|
||||||
[Define if compile max ttf cahce number for 40])
|
[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,
|
AC_DEFINE(_MGMAX_TTF_CACHE, 32,
|
||||||
[Define if compile max ttf cahce number for 10 (default value)])
|
[Define if compile max ttf cahce number for 32 (default value)])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -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)
|
496 static int euckr_is_this_charset (const unsigned char* charset)
|
||||||
497 {
|
497 {
|
||||||
498 int i;
|
498 int i;
|
||||||
499 char name [LEN_FONT_NAME + 1];
|
499 char name [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
500
|
500
|
||||||
501 for (i = 0; i < LEN_FONT_NAME + 1; i++) {
|
501 for (i = 0; i < LEN_LOGFONT_NAME_FIELD + 1; i++) {
|
||||||
502 if (charset [i] == '\0')
|
502 if (charset [i] == '\0')
|
||||||
503 break;
|
503 break;
|
||||||
504 name [i] = toupper (charset [i]);
|
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>
|
<table border="0" cellpadding="0" class="code-sample" width="100%"><tr><td> <pre>
|
||||||
228 typedef struct _LOGFONT {
|
228 typedef struct _LOGFONT {
|
||||||
229 char type [LEN_FONT_NAME + 1];
|
229 char type [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
230 char family [LEN_FONT_NAME + 1];
|
230 char family [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
231 char charset [LEN_FONT_NAME + 1];
|
231 char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
232 DWORD style;
|
232 DWORD style;
|
||||||
233 int size;
|
233 int size;
|
||||||
234 int rotation;
|
234 int rotation;
|
||||||
|
|||||||
+12
-12
@@ -1,14 +1,14 @@
|
|||||||
static LOGFONT *logfont, *logfontgb12, *logfontbig24;
|
static LOGFONT *logfont, *logfontgb12, *logfontbig24;
|
||||||
|
|
||||||
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
|
logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
|
||||||
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_SETWIDTH_NORMAL,
|
FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_FLIP_NONE,
|
||||||
FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
|
FONT_OTHER_NIL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
|
||||||
16, 0);
|
16, 0);
|
||||||
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
|
logfontgb12 = CreateLogFont (NULL, "song", "GB2312",
|
||||||
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
|
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
|
||||||
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
|
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_LINE,
|
||||||
12, 0);
|
12, 0);
|
||||||
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
|
logfontbig24 = CreateLogFont (NULL, "ming", "BIG5",
|
||||||
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
|
FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_FLIP_NONE,
|
||||||
FONT_SPACING_CHARCELL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
|
FONT_OTHER_NIL, FONT_UNDERLINE_LINE, FONT_STRUCKOUT_NONE,
|
||||||
24, 0);
|
24, 0);
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -694,6 +694,20 @@ typedef UINT_PTR LPARAM;
|
|||||||
*/
|
*/
|
||||||
#define MAKEWORD16(low, high) ((WORD16)(((BYTE)(low)) | (((WORD16)((BYTE)(high))) << 8)))
|
#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)
|
* \def MAKEWPARAM(first, second, third, fourth)
|
||||||
* \brief Makes a WPARAM value with four bytes.
|
* \brief Makes a WPARAM value with four bytes.
|
||||||
|
|||||||
+2935
-679
File diff suppressed because it is too large
Load Diff
+238
-240
File diff suppressed because it is too large
Load Diff
+36
-37
@@ -44,21 +44,20 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _GLYPHBUF
|
typedef struct _ACHARBUF
|
||||||
{
|
{
|
||||||
GLYPHMAPINFO* glyph_map; /* glyph info array */
|
ACHARMAPINFO* achar_map; /* achar info array */
|
||||||
int* glyphs; /* glyph array */
|
Achar32* achars; /* achar array */
|
||||||
int glyphs_len; /* glyph array len or buffer used size */
|
int achars_len; /* achar array len or buffer used size */
|
||||||
|
|
||||||
int blocksize; /* block size, a block is an allocate unit */
|
int blocksize; /* block size, a block is an allocate unit */
|
||||||
int glyphs_buffsize; /* glyph string buffer size */
|
int achars_buffsize; /* achar string buffer size */
|
||||||
int glyphmap_buffsize; /* glyph map buffer size */
|
int acharmap_buffsize; /* achar map buffer size */
|
||||||
} GLYPHBUF;
|
} ACHARBUF;
|
||||||
|
|
||||||
typedef struct tagBIDISLEDITDATA
|
typedef struct tagBIDISLEDITDATA
|
||||||
{
|
{
|
||||||
StrBuffer str_content; // string text buffer
|
StrBuffer str_content; // string text buffer
|
||||||
GLYPHBUF glyph_content; // glyph string buffer
|
ACHARBUF achar_content; // achar string buffer
|
||||||
|
|
||||||
int editPos; // current edit position
|
int editPos; // current edit position
|
||||||
int selStart; // selection start position
|
int selStart; // selection start position
|
||||||
@@ -92,48 +91,48 @@ typedef struct tagBIDISLEDITDATA
|
|||||||
typedef BIDISLEDITDATA* PBIDISLEDITDATA;
|
typedef BIDISLEDITDATA* PBIDISLEDITDATA;
|
||||||
|
|
||||||
static inline void*
|
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))
|
achar_buff->achars_buffsize = (len + (block_size - len % block_size))
|
||||||
* sizeof (int);
|
* sizeof (Achar32);
|
||||||
glyph_buff->glyphs = malloc (glyph_buff->glyphs_buffsize);
|
achar_buff->achars = malloc (achar_buff->achars_buffsize);
|
||||||
|
|
||||||
glyph_buff->glyphmap_buffsize = (len + (block_size - len % block_size))
|
achar_buff->acharmap_buffsize = (len + (block_size - len % block_size))
|
||||||
* sizeof (GLYPHMAPINFO);
|
* sizeof (ACHARMAPINFO);
|
||||||
glyph_buff->glyph_map = malloc (glyph_buff->glyphmap_buffsize);
|
achar_buff->achar_map = malloc (achar_buff->acharmap_buffsize);
|
||||||
|
|
||||||
glyph_buff->glyphs_len = len;
|
achar_buff->achars_len = len;
|
||||||
glyph_buff->blocksize = block_size;
|
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) {
|
if (achar_buff) {
|
||||||
free (glyph_buff->glyphs);
|
free (achar_buff->achars);
|
||||||
free (glyph_buff->glyph_map);
|
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 ||
|
if (len * sizeof(int) > achar_buff->achars_buffsize ||
|
||||||
len * sizeof(int) < glyph_buff->glyphs_buffsize - glyph_buff->blocksize) {
|
len * sizeof(int) < achar_buff->achars_buffsize - achar_buff->blocksize) {
|
||||||
/* realloc glyph string mem */
|
/* realloc achar string mem */
|
||||||
glyph_buff->glyphs_buffsize = (len + (glyph_buff->blocksize -
|
achar_buff->achars_buffsize = (len + (achar_buff->blocksize -
|
||||||
len % glyph_buff->blocksize))* sizeof(int);
|
len % achar_buff->blocksize))* sizeof(Achar32);
|
||||||
glyph_buff->glyphs = realloc (glyph_buff->glyphs,
|
achar_buff->achars = realloc (achar_buff->achars,
|
||||||
glyph_buff->glyphs_buffsize);
|
achar_buff->achars_buffsize);
|
||||||
|
|
||||||
/* realloc glyph map mem */
|
/* realloc achar map mem */
|
||||||
glyph_buff->glyphmap_buffsize = (len + (glyph_buff->blocksize -
|
achar_buff->acharmap_buffsize = (len + (achar_buff->blocksize -
|
||||||
len % glyph_buff->blocksize))* sizeof(GLYPHMAPINFO);
|
len % achar_buff->blocksize))* sizeof(ACHARMAPINFO);
|
||||||
glyph_buff->glyph_map = realloc (glyph_buff->glyph_map,
|
achar_buff->achar_map = realloc (achar_buff->achar_map,
|
||||||
glyph_buff->glyphmap_buffsize);
|
achar_buff->acharmap_buffsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return glyph_buff->glyphs;
|
return achar_buff->achars;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL RegisterBIDISLEditControl (void);
|
BOOL RegisterBIDISLEditControl (void);
|
||||||
|
|||||||
@@ -271,30 +271,30 @@ static void set_keyboard_layout(HWND hDlg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (cur_type == GLYPH_TYPE_RTL) {
|
if (cur_type == CHAR_TYPE_RTL) {
|
||||||
if (l_glyph_type == GLYPH_TYPE_RTL)
|
if (l_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
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);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR)
|
if (l_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
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);
|
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (l_glyph_type == GLYPH_TYPE_LTR)
|
if (l_char_type == CHAR_TYPE_LTR)
|
||||||
return INSERTPOS_AFTER (sled, l_glyph_index);
|
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);
|
return INSERTPOS_BEFORE (sled, r_glyph_index);
|
||||||
else {
|
else {
|
||||||
if (l_glyph_type == GLYPH_TYPE_RTL)
|
if (l_char_type == CHAR_TYPE_RTL)
|
||||||
return INSERTPOS_BEFORE (sled, l_glyph_index);
|
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);
|
return INSERTPOS_AFTER (sled, r_glyph_index);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+11
-5
@@ -1458,7 +1458,6 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
rctop = rc.top;
|
rctop = rc.top;
|
||||||
|
|
||||||
if (mouseX <= right && mouseX >= left && (p != pData->pItemSelected) ) {
|
if (mouseX <= right && mouseX >= left && (p != pData->pItemSelected) ) {
|
||||||
PLOGFONT logfont;
|
|
||||||
c = getCountFromItem (pData, pData->pItemSelected);
|
c = getCountFromItem (pData, pData->pItemSelected);
|
||||||
c = c - pData->nItemTop - 1;
|
c = c - pData->nItemTop - 1;
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
@@ -1471,12 +1470,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
rc.top += TV_BORDER;
|
rc.top += TV_BORDER;
|
||||||
rc.bottom = rc.top + pData->nItemHeight;
|
rc.bottom = rc.top + pData->nItemHeight;
|
||||||
|
|
||||||
/*bugfix: 4864, zhaochengzhang*/
|
/* VincentWei: do not depend on logfont style
|
||||||
|
PLOGFONT logfont;
|
||||||
|
//bugfix: 4864, zhaochengzhang
|
||||||
logfont = GetWindowFont(hwnd);
|
logfont = GetWindowFont(hwnd);
|
||||||
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
|
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
|
||||||
rc.left--; rc.top--;
|
rc.left--; rc.top--;
|
||||||
rc.right++; rc.bottom++;
|
rc.right++; rc.bottom++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
InvalidateRect (hwnd, &rc, TRUE);
|
InvalidateRect (hwnd, &rc, TRUE);
|
||||||
|
|
||||||
rc.top = rctop + (count - pData->nItemTop - 1) * pData->nItemHeight;
|
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.top += TV_BORDER;
|
||||||
rc.bottom = rc.top + pData->nItemHeight;
|
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)) {
|
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
|
||||||
rc.left--; rc.top--;
|
rc.left--; rc.top--;
|
||||||
rc.right++; rc.bottom++;
|
rc.right++; rc.bottom++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
InvalidateRect (hwnd, &rc, TRUE);
|
InvalidateRect (hwnd, &rc, TRUE);
|
||||||
NotifyParent (hwnd, pData->id, TVN_CLICKED);
|
NotifyParent (hwnd, pData->id, TVN_CLICKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mouseX <= left + h && mouseX >= left) {
|
if (mouseX <= left + h && mouseX >= left) {
|
||||||
PLOGFONT logfont;
|
|
||||||
if (p->child == NULL)
|
if (p->child == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1519,12 +1522,15 @@ static LRESULT TreeViewCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
|||||||
tvSetHScrollInfo (hwnd, pData, TRUE);
|
tvSetHScrollInfo (hwnd, pData, TRUE);
|
||||||
rc.bottom = rcClient.bottom;
|
rc.bottom = rcClient.bottom;
|
||||||
|
|
||||||
/*bugfix: 4864 zhaochengzhang*/
|
/* VincentWei: do not depend on the logfont style
|
||||||
|
PLOGFONT logfont;
|
||||||
|
//bugfix: 4864 zhaochengzhang
|
||||||
logfont = GetWindowFont(hwnd);
|
logfont = GetWindowFont(hwnd);
|
||||||
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
|
if (logfont->style & (FS_WEIGHT_BOOK | FS_WEIGHT_LIGHT)) {
|
||||||
rc.left--; rc.top--;
|
rc.left--; rc.top--;
|
||||||
rc.right++; rc.bottom++;
|
rc.right++; rc.bottom++;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
InvalidateRect (hwnd, &rc, TRUE);
|
InvalidateRect (hwnd, &rc, TRUE);
|
||||||
NotifyParent (hwnd, pData->id, TVN_CLICKED);
|
NotifyParent (hwnd, pData->id, TVN_CLICKED);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-6
@@ -3,21 +3,25 @@ SUBDIRS = in-core
|
|||||||
noinst_LTLIBRARIES = libfont.la
|
noinst_LTLIBRARIES = libfont.la
|
||||||
|
|
||||||
SRC_FILES = charset.c charset-arabic.c charset-bidi.c \
|
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 \
|
sysfont.c logfont.c devfont.c fontname.c \
|
||||||
rawbitmap.c varbitmap.c qpf.c upf.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 \
|
gbunimap.c gbkunimap.c gb18030unimap.c big5unimap.c \
|
||||||
ujisunimap.c sjisunimap.c euckrunimap.c \
|
ujisunimap.c sjisunimap.c euckrunimap.c \
|
||||||
textops.c mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
|
textops.c mapunitogb.c mapunitogbk.c mapunitobig5.c mapunitogb18030.c \
|
||||||
bitmapfont.c scripteasy.c
|
bitmapfont.c scripteasy.c \
|
||||||
|
unicode-emoji.c
|
||||||
|
|
||||||
HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype1.h freetype2.h qpf.h \
|
HDR_FILES = charset.h rawbitmap.h varbitmap.h freetype2.h qpf.h se_minigui.h \
|
||||||
upf.h bitmapfont.h gunichartables.h se_minigui.h unicode-bidi-tables.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) \
|
EXTRA_DIST = convgbmap.c jisunimap.c $(SRC_FILES) $(HDR_FILES) \
|
||||||
makefile.ng makefile.msvc
|
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
|
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||||
|
|
||||||
libfont_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
|
libfont_la_SOURCES = $(SRC_FILES) $(HDR_FILES)
|
||||||
|
|||||||
+18
-13
@@ -190,7 +190,7 @@ static void destroy (GLYPHTREENODE *root)
|
|||||||
|
|
||||||
/*** device font ops ***/
|
/*** device font ops ***/
|
||||||
|
|
||||||
static DWORD get_glyph_type (LOGFONT* logfont, DEVFONT* devfont)
|
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
|
||||||
{
|
{
|
||||||
return DEVFONTGLYPHTYPE_PRERDRBMP;
|
return DEVFONTGLYPHTYPE_PRERDRBMP;
|
||||||
}
|
}
|
||||||
@@ -210,8 +210,11 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
return ((BMPFONTINFO *)devfont->data)->height;
|
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;
|
return ((BMPFONTINFO *)devfont->data)->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +368,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
|
|
||||||
/**************************** Global data ************************************/
|
/**************************** Global data ************************************/
|
||||||
FONTOPS __mg_bitmap_font_ops = {
|
FONTOPS __mg_bitmap_font_ops = {
|
||||||
get_glyph_type,
|
get_glyph_bmptype,
|
||||||
get_ave_width,
|
get_ave_width,
|
||||||
get_max_width,
|
get_max_width,
|
||||||
get_font_height,
|
get_font_height,
|
||||||
@@ -408,7 +411,6 @@ build_bmpfont_info (const char *bmpfont_name, const BITMAP* glyph_bmp,
|
|||||||
goto error_load;
|
goto error_load;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bmpfont_info->ave_width = glyph_width;
|
bmpfont_info->ave_width = glyph_width;
|
||||||
bmpfont_info->max_width = glyph_width;
|
bmpfont_info->max_width = glyph_width;
|
||||||
bmpfont_info->node_cnt = 1;
|
bmpfont_info->node_cnt = 1;
|
||||||
@@ -441,6 +443,7 @@ error_load:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 // VincentWei: bad implementation
|
||||||
static int set_devfont_style (char* name, char style)
|
static int set_devfont_style (char* name, char style)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -461,7 +464,7 @@ static int set_devfont_style (char* name, char style)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/************************/
|
/************************/
|
||||||
DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
|
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;
|
DEVFONT* bitmapfont_dev_font = NULL;
|
||||||
CHARSETOPS* charset_ops;
|
CHARSETOPS* charset_ops;
|
||||||
char charset[LEN_FONT_NAME + 1];
|
char charset[LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
BMPFONTINFO *bmpfont_info;
|
BMPFONTINFO *bmpfont_info;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
@@ -484,7 +487,7 @@ DEVFONT *CreateBMPDevFont (const char *bmpfont_name, const BITMAP* glyph_bmp,
|
|||||||
goto error_create;
|
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);
|
(const unsigned char*) start_mchar, 0);
|
||||||
|
|
||||||
bmpfont_info = build_bmpfont_info (bmpfont_name, glyph_bmp,
|
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;
|
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))
|
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_WEIGHT_BOLD))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_SLANT_ITALIC))
|
if (!set_devfont_style (bitmapfont_dev_font->name, FONT_SLANT_ITALIC))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
bitmapfont_dev_font->name [LEN_UNIDEVFONT_NAME] = '\0';
|
bitmapfont_dev_font->name [LEN_UNIDEVFONT_NAME] = '\0';
|
||||||
bitmapfont_dev_font->style = fontConvertStyle (bitmapfont_dev_font->name);
|
bitmapfont_dev_font->style = fontConvertStyle (bitmapfont_dev_font->name);
|
||||||
@@ -545,7 +550,7 @@ BOOL AddGlyphsToBMPFont (DEVFONT* dev_font, BITMAP* glyph_bmp,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Insert a node in the avl tree */
|
/* 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);
|
(const unsigned char*)start_mchar, 0);
|
||||||
|
|
||||||
if (look_up (root, offset) == NULL) {
|
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;
|
GLYPHTREENODE *p;
|
||||||
int offset;
|
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);
|
(const unsigned char*)start_mchar, n);
|
||||||
offset += n;
|
offset += n;
|
||||||
|
|
||||||
|
|||||||
+76
-72
@@ -51,7 +51,7 @@ typedef struct _SHAPEINFO {
|
|||||||
#define MAX_GLYPH_VALUE 0x133
|
#define MAX_GLYPH_VALUE 0x133
|
||||||
#define SHAPENUMBER 36
|
#define SHAPENUMBER 36
|
||||||
static const SHAPEINFO shape_info[SHAPENUMBER] = {
|
static const SHAPEINFO shape_info[SHAPENUMBER] = {
|
||||||
/* Base Isol Final Initial Medial */
|
/* Base Isol Final Initial Medial */
|
||||||
{ /* 0 0xC1 (0x0621) */ 0xC1/*0xFE80*/, 0x00, 0x00, 0x00 /* Arabic letter Hamza */ },
|
{ /* 0 0xC1 (0x0621) */ 0xC1/*0xFE80*/, 0x00, 0x00, 0x00 /* Arabic letter Hamza */ },
|
||||||
{ /* 1 0xC2 (0x0622) */ 0xC2/*0xFE81*/, 0x102/*0xFE82*/, 0x00, 0x00 /* Arabic letter Alef with Madda above */ },
|
{ /* 1 0xC2 (0x0622) */ 0xC2/*0xFE81*/, 0x102/*0xFE82*/, 0x00, 0x00 /* Arabic letter Alef with Madda above */ },
|
||||||
{ /* 2 0xC3 (0x0623) */ 0xC3/*0xFE83*/, 0x103/*0xFE84*/, 0x00, 0x00 /* Arabic letter Alef with Hamza above */ },
|
{ /* 2 0xC3 (0x0623) */ 0xC3/*0xFE83*/, 0x103/*0xFE84*/, 0x00, 0x00 /* Arabic letter Alef with Hamza above */ },
|
||||||
@@ -94,9 +94,9 @@ static const SHAPEINFO shape_info[SHAPENUMBER] = {
|
|||||||
static int iso8859_6_is_this_charset (const unsigned char* charset)
|
static int iso8859_6_is_this_charset (const unsigned char* charset)
|
||||||
{
|
{
|
||||||
int i;
|
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')
|
if (charset [i] == '\0')
|
||||||
break;
|
break;
|
||||||
name [i] = toupper (charset [i]);
|
name [i] = toupper (charset [i]);
|
||||||
@@ -174,17 +174,17 @@ static unsigned short iso8859_68x_unicode_map [] =
|
|||||||
0xFEF7, 0xFEF8, 0xFEF9, 0xFEFA, /*0x130~0x133*/
|
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)
|
if (chv < 0x81)
|
||||||
return (Glyph32) (glyph_value);
|
return (Achar32) (chv);
|
||||||
else if (glyph_value <= MAX_GLYPH_VALUE )
|
else if (chv <= MAX_GLYPH_VALUE )
|
||||||
return (Glyph32) iso8859_68x_unicode_map[glyph_value - 0x81];
|
return (Achar32) iso8859_68x_unicode_map[chv - 0x81];
|
||||||
else
|
else
|
||||||
return 0xFFFF;
|
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) {
|
switch (wc) {
|
||||||
case 0x060C:
|
case 0x060C:
|
||||||
@@ -212,8 +212,8 @@ static int iso8859_6_conv_from_uc32 (UChar32 wc, unsigned char* mchar)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* must attetion the para s is arabic glyph value.*/
|
/* must attetion the para s is arabic chv value.*/
|
||||||
static int is_arabic_glyph_vowel(Uint8 c)
|
static int is_arabic_char_vowel(Uint8 c)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((c >= 0x81) && (c <= 0x86)) return 1;
|
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.
|
/* this define is relative with fontset 0xa1~0xa7.
|
||||||
* it it used for ligature such as LAM+ALEF, one ligature
|
* 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 0x12C //0xA1A5
|
||||||
#define LAM_ALIF_F 0x12D //0xA1A6
|
#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
|
/* 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
|
* do it in the follow five functions, if the fontset is change, you only
|
||||||
* need to implement follow five interface.
|
* need to implement follow five interface.
|
||||||
* 1. get_vowel_glyph().
|
* 1. get_vowel_char().
|
||||||
* 2. get_twovowel_glyph().
|
* 2. get_twovowel_char().
|
||||||
* 3. get_tadweel_glyph().
|
* 3. get_tadweel_char().
|
||||||
* 4. get_ligature_glyph().
|
* 4. get_ligature_char().
|
||||||
* 5. get_punpoint_glyph().
|
* 5. get_punpoint_char().
|
||||||
* houhh 20080128.
|
* houhh 20080128.
|
||||||
* */
|
* */
|
||||||
|
|
||||||
static int fontset_68x_get_punpoint_glyph(Uint8 c)
|
static int fontset_68x_get_punpoint_char(Uint8 c)
|
||||||
{
|
{
|
||||||
int ligature = -1;
|
int ligature = -1;
|
||||||
switch(c){
|
switch(c){
|
||||||
@@ -293,7 +293,7 @@ static int fontset_68x_get_punpoint_glyph(Uint8 c)
|
|||||||
return ligature;
|
return ligature;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fontset_68x_get_vowel_glyph(Uint8 c)
|
static int fontset_68x_get_vowel_char(Uint8 c)
|
||||||
{
|
{
|
||||||
int ligature = -1;
|
int ligature = -1;
|
||||||
switch(c){
|
switch(c){
|
||||||
@@ -310,7 +310,7 @@ static int fontset_68x_get_vowel_glyph(Uint8 c)
|
|||||||
return ligature;
|
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;
|
int ligature = -1;
|
||||||
if(c == SHADDA){
|
if(c == SHADDA){
|
||||||
@@ -326,12 +326,12 @@ static int fontset_68x_get_twovowel_glyph(unsigned char c, unsigned char next, i
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*ignore = 0;
|
*ignore = 0;
|
||||||
ligature = fontset_68x_get_vowel_glyph(c);
|
ligature = fontset_68x_get_vowel_char(c);
|
||||||
}
|
}
|
||||||
return ligature;
|
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;
|
int ligature = -1;
|
||||||
if(prev_affects_joining){
|
if(prev_affects_joining){
|
||||||
@@ -355,7 +355,7 @@ static int fontset_68x_get_ligature_glyph(unsigned char c, BOOL prev_affects_joi
|
|||||||
return ligature;
|
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;
|
int ligature = -1;
|
||||||
if(c == SHADDA){
|
if(c == SHADDA){
|
||||||
@@ -400,12 +400,12 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
|
|||||||
|
|
||||||
cur_char = *mchar;
|
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(ligature > 0) return ligature;
|
||||||
|
|
||||||
if(len == 1){
|
if(len == 1){
|
||||||
if (ISARABIC_VOWEL(cur_char)){
|
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){
|
else if(cur_char == TADWEEL){
|
||||||
ligature = TADWEEL;
|
ligature = TADWEEL;
|
||||||
@@ -414,16 +414,16 @@ int get_ligature(const unsigned char* mchar, int len, BOOL prev_affects_joining,
|
|||||||
else if(len > 1){
|
else if(len > 1){
|
||||||
next = *(mchar+1);
|
next = *(mchar+1);
|
||||||
if (ISARABIC_VOWEL(cur_char)){ /* two VOWEL, one must be SHADDA first. */
|
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. */
|
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*/
|
else if(cur_char == TADWEEL){ /* TADWEEL combine with VOWEL*/
|
||||||
if(len > 2) next_next = *(mchar+2);
|
if(len > 2) next_next = *(mchar+2);
|
||||||
else next_next = 0;
|
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){
|
if(ligature == -1 && cur_char == TADWEEL){
|
||||||
ligature = 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))
|
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
|
||||||
|
|
||||||
static unsigned int iso8859_6_glyph_type (Glyph32 glyph_value)
|
static unsigned int iso8859_6_char_type (Achar32 chv)
|
||||||
{
|
{
|
||||||
unsigned int ch_type = MCHAR_TYPE_UNKNOWN;
|
unsigned int ch_type = 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;
|
ch_type = MCHAR_TYPE_VOWEL;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ch_type = sb_glyph_type (glyph_value);
|
ch_type = sb_char_type (chv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch_type;
|
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,
|
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)
|
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;
|
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;
|
BOOL next_affects_joining = FALSE, prev_affects_joining = FALSE;
|
||||||
int char_index, prev_index;
|
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);
|
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)
|
if (char_index < 0 && !ISARABIC_PUNC(*mchar)
|
||||||
&& !ISARABIC_VOWEL(*mchar) && !(*mchar == TADWEEL)) {
|
&& !ISARABIC_VOWEL(*mchar) && !(*mchar == TADWEEL)) {
|
||||||
return *mchar;
|
return *mchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(prev_mchar){
|
if (prev_mchar) {
|
||||||
prev_index = get_table_index(*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;
|
// NUV prev_char = *prev_mchar;
|
||||||
/*houhh 20080505, check if ligature. */
|
/*houhh 20080505, check if ligature. */
|
||||||
if(prev_affects_joining) {
|
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,
|
/*if cur_len>1, search ligature shape,
|
||||||
* else search letter or phonetic symbol 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)
|
int cur_len, int shape_type)
|
||||||
{
|
{
|
||||||
Glyph32 glyph_value = -1;
|
Achar32 chv = -1;
|
||||||
int ignore;
|
int ignore;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
if (cur_len > 1)
|
if (cur_len > 1)
|
||||||
{
|
{
|
||||||
if (shape_type == GLYPH_ISOLATED)
|
if (shape_type == ACHAR_ISOLATED)
|
||||||
glyph_value = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
|
chv = get_ligature (cur_mchar, cur_len, FALSE, &ignore);
|
||||||
else if (shape_type != GLYPH_INITIAL) {
|
else if (shape_type != ACHAR_INITIAL) {
|
||||||
/* LAM+ALEF+HAMAZ+MADDA ligature. */
|
/* LAM+ALEF+HAMAZ+MADDA ligature. */
|
||||||
if (*cur_mchar == LAM)
|
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)){
|
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);
|
index = get_table_index(*cur_mchar);
|
||||||
if (index >=0)
|
if (index >=0)
|
||||||
{
|
{
|
||||||
switch (shape_type) {
|
switch (shape_type) {
|
||||||
case GLYPH_ISOLATED:
|
case ACHAR_ISOLATED:
|
||||||
glyph_value = shape_info[index].isolated;
|
chv = shape_info[index].isolated;
|
||||||
break;
|
break;
|
||||||
case GLYPH_FINAL:
|
case ACHAR_FINAL:
|
||||||
glyph_value = shape_info[index].final;
|
chv = shape_info[index].final;
|
||||||
break;
|
break;
|
||||||
case GLYPH_INITIAL:
|
case ACHAR_INITIAL:
|
||||||
glyph_value = shape_info[index].initial;
|
chv = shape_info[index].initial;
|
||||||
break;
|
break;
|
||||||
case GLYPH_MEDIAL:
|
case ACHAR_MEDIAL:
|
||||||
glyph_value = shape_info[index].medial;
|
chv = shape_info[index].medial;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
glyph_value = *cur_mchar;
|
chv = *cur_mchar;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glyph_value == 0)
|
if (chv == 0)
|
||||||
glyph_value =-1;
|
chv =-1;
|
||||||
|
|
||||||
return glyph_value;
|
return chv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
|
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}
|
// {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,
|
return get_mirror_char (__mg_iso8859_68x_mirror_table,
|
||||||
TABLESIZE (__mg_iso8859_68x_mirror_table), glyph, mirrored);
|
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CHARSETOPS CharsetOps_iso8859_6 = {
|
static CHARSETOPS CharsetOps_iso8859_6 = {
|
||||||
256,
|
256,
|
||||||
3,
|
1,
|
||||||
FONT_CHARSET_ISO8859_6,
|
FONT_CHARSET_ISO8859_6,
|
||||||
0,
|
0,
|
||||||
iso8859_6_len_first_char,
|
iso8859_6_len_first_char,
|
||||||
iso8859_6_char_glyph_value,
|
iso8859_6_get_char_value,
|
||||||
iso8859_6_glyph_shape,
|
iso8859_6_get_shaped_char_value,
|
||||||
iso8859_6_glyph_type,
|
iso8859_6_char_type,
|
||||||
sb_nr_chars_in_str,
|
sb_nr_chars_in_str,
|
||||||
iso8859_6_is_this_charset,
|
iso8859_6_is_this_charset,
|
||||||
sb_len_first_substr,
|
sb_len_first_substr,
|
||||||
iso8859_6_get_next_word,
|
iso8859_6_get_next_word,
|
||||||
sb_pos_first_char,
|
sb_pos_first_char,
|
||||||
iso8859_6_bidi_glyph_type,
|
iso8859_6_bidi_char_type,
|
||||||
iso8859_6_bidi_mirror_glyph,
|
iso8859_6_bidi_mirror_char,
|
||||||
#ifdef _MGCHARSET_UNICODE
|
#ifdef _MGCHARSET_UNICODE
|
||||||
iso8859_6_conv_to_uc32,
|
iso8859_6_conv_to_uc32,
|
||||||
iso8859_6_conv_from_uc32
|
iso8859_6_conv_from_uc32
|
||||||
@@ -864,14 +868,14 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#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;
|
int i = 0;
|
||||||
for (i = 0; i<SHAPENUMBER; i++) {
|
for (i = 0; i<SHAPENUMBER; i++) {
|
||||||
if (shape_info[i].isolated == glyph_value ||
|
if (shape_info[i].isolated == chv ||
|
||||||
shape_info[i].initial == glyph_value ||
|
shape_info[i].initial == chv ||
|
||||||
shape_info[i].medial == glyph_value ||
|
shape_info[i].medial == chv ||
|
||||||
shape_info[i].final == glyph_value )
|
shape_info[i].final == chv )
|
||||||
if( char_index == i)
|
if( char_index == i)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
+116
-93
@@ -133,7 +133,7 @@ static void print_run_types(TYPERUN *pp)
|
|||||||
fprintf (stderr, "\n");
|
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;
|
int m = 0;
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ static void print_hexstr(Glyph32* str, int len, BOOL reorder_state)
|
|||||||
|
|
||||||
#else /* BIDI_DEBUG */
|
#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;
|
return;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ static void compact_neutrals (TYPERUN *list)
|
|||||||
(p) = (q); \
|
(p) = (q); \
|
||||||
} while (0)
|
} 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;
|
int type = 0;
|
||||||
TYPERUN *list, *last, *link;
|
TYPERUN *list, *last, *link;
|
||||||
@@ -231,7 +231,7 @@ static TYPERUN* get_runtype_link (const CHARSETOPS* charset_ops, Glyph32* glyphs
|
|||||||
last = list;
|
last = list;
|
||||||
|
|
||||||
for (i = 0; i < len; i++){
|
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 = calloc(1, sizeof(TYPERUN));
|
||||||
link->type = type;
|
link->type = type;
|
||||||
link->pos = i;
|
link->pos = i;
|
||||||
@@ -473,7 +473,7 @@ static int bidi_resolveImplicit(TYPERUN **ptype_rl_list, int base_level)
|
|||||||
|
|
||||||
/* 6.Resolving Mirrored Char. */
|
/* 6.Resolving Mirrored Char. */
|
||||||
static void
|
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 **ptype_rl_list, int base_level)
|
||||||
{
|
{
|
||||||
TYPERUN *type_rl_list = *ptype_rl_list, *pp = NULL;
|
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;
|
int i;
|
||||||
for (i = POS (pp); i < POS (pp) + LEN (pp); i++)
|
for (i = POS (pp); i < POS (pp) + LEN (pp); i++)
|
||||||
{
|
{
|
||||||
Glyph32 mirrored_ch;
|
Achar32 mirrored_ch;
|
||||||
if (charset_ops->bidi_mirror_glyph && charset_ops->bidi_mirror_glyph (glyphs[i], &mirrored_ch))
|
if (charset_ops->bidi_mirror_char && charset_ops->bidi_mirror_char (achars[i], &mirrored_ch))
|
||||||
glyphs[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");
|
DBGLOG (" Mirroring, Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bidi_map_reverse (void* context, int len, int pos)
|
static void bidi_resolve_string (const CHARSETOPS* charset_ops,
|
||||||
{
|
Achar32* achars, int len, int pel,
|
||||||
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,
|
|
||||||
TYPERUN **ptype_rl_list, BYTE *pmax_level)
|
TYPERUN **ptype_rl_list, BYTE *pmax_level)
|
||||||
{
|
{
|
||||||
BYTE base_level = 0;
|
BYTE base_level = 0;
|
||||||
@@ -540,10 +505,16 @@ static void bidi_resolve_string (const CHARSETOPS* charset_ops, Glyph32* glyphs,
|
|||||||
TYPERUN *type_rl_list = NULL;
|
TYPERUN *type_rl_list = NULL;
|
||||||
|
|
||||||
/* split the text to some runs. */
|
/* 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 */
|
/* 1.Find base level */
|
||||||
bidi_resolveParagraphs(&type_rl_list, &base_dir, &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.*/
|
/* 2.Resolving Explicit levels.*/
|
||||||
bidi_resolveExplicit(&type_rl_list, base_dir);
|
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);
|
*pmax_level = bidi_resolveImplicit(&type_rl_list, base_level);
|
||||||
|
|
||||||
/* 6.Resolving Mirrored Char. */
|
/* 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;
|
*ptype_rl_list = type_rl_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bidi_reorder_cb (void* context, int len,
|
typedef struct _REORDER_CONTEXT {
|
||||||
TYPERUN **ptype_rl_list, BYTE max_level, CB_DO_REORDER cb)
|
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;
|
int i = 0;
|
||||||
TYPERUN *type_rl_list = *ptype_rl_list, *pp = NULL;
|
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;
|
pp1 = pp1->next;
|
||||||
}
|
}
|
||||||
pp = pp1->prev;
|
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");
|
DBGLOG("\nReordering, Done\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void __mg_charset_bidi_get_embeddlevels (const CHARSETOPS* charset_ops, Glyph32* glyphs, int len,
|
static void bidi_reverse_chars (void* context, int len, int pos)
|
||||||
Uint8* embedding_level_list, Uint8 type)
|
{
|
||||||
|
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;
|
int i = 0;
|
||||||
BYTE max_level = 1;
|
BYTE max_level = 1;
|
||||||
TYPERUN *type_rl_list = NULL, *pp;
|
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. */
|
/* 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.*/
|
/* type = 0, get the logical embedding level; else visual level.*/
|
||||||
for (pp = type_rl_list->next; pp->next; pp = pp->next){
|
for (pp = type_rl_list->next; pp->next; pp = pp->next){
|
||||||
int pos = POS (pp), len = LEN (pp);
|
int pos = POS (pp), len = LEN (pp);
|
||||||
for(i = 0; i < len; i++)
|
for(i = 0; i < len; i++)
|
||||||
embedding_level_list[pos + i] = LEVEL(pp);
|
embedding_levels[pos + i] = LEVEL(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
bidi_reorder_cb(embedding_level_list, len, &type_rl_list, max_level,
|
REORDER_CONTEXT rc;
|
||||||
bidi_index_reverse);
|
|
||||||
|
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.*/
|
||||||
free_typerun_list(type_rl_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,
|
#if 0
|
||||||
int len, GLYPHMAPINFO* map)
|
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;
|
BYTE max_level = 1;
|
||||||
TYPERUN *type_rl_list = NULL;
|
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_pos;
|
||||||
int run_len;
|
int run_len;
|
||||||
|
|
||||||
print_hexstr(glyphs, len, FALSE);
|
print_hexstr(achars, len, FALSE);
|
||||||
|
|
||||||
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
|
/* 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;
|
for (node_p=type_rl_list->next; node_p->next; node_p=node_p->next) {
|
||||||
node_p=node_p->next)
|
|
||||||
{
|
|
||||||
run_pos = node_p->pos;
|
run_pos = node_p->pos;
|
||||||
run_len = node_p->len;
|
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.*/
|
||||||
free_typerun_list(type_rl_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,
|
Achar32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops,
|
||||||
int len, int* index_map)
|
Achar32* achars, int len, int* index_map, int pel)
|
||||||
{
|
{
|
||||||
BYTE max_level = 1;
|
BYTE max_level = 1;
|
||||||
TYPERUN *type_rl_list = NULL;
|
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. */
|
/* 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_reorder_cb(index_map, len, &type_rl_list, max_level,
|
||||||
bidi_string_reverse);
|
bidi_string_reverse);
|
||||||
@@ -674,39 +699,48 @@ Glyph32* __mg_charset_bidi_index_reorder (const CHARSETOPS* charset_ops, Glyph32
|
|||||||
/* free typerun list.*/
|
/* free typerun list.*/
|
||||||
free_typerun_list(type_rl_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;
|
BYTE max_level = 1;
|
||||||
TYPERUN *type_rl_list = NULL;
|
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. */
|
/* 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.*/
|
||||||
free_typerun_list (type_rl_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;
|
BYTE base_level = 0;
|
||||||
Uint32 base_dir = BIDI_TYPE_L;
|
Uint32 base_dir = BIDI_TYPE_L;
|
||||||
TYPERUN *type_rl_list = NULL;
|
TYPERUN *type_rl_list = NULL;
|
||||||
|
|
||||||
/* split the text to some runs. */
|
/* 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 */
|
/* 1.Find base level */
|
||||||
bidi_resolveParagraphs(&type_rl_list, &base_dir, &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;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+915
-349
File diff suppressed because it is too large
Load Diff
+229
-82
File diff suppressed because it is too large
Load Diff
+42
-59
@@ -58,25 +58,22 @@
|
|||||||
#include "freetype2.h"
|
#include "freetype2.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef struct _MemBlk {
|
||||||
typedef struct _MemBlk
|
|
||||||
{
|
|
||||||
void *data;
|
void *data;
|
||||||
int len;
|
int len;
|
||||||
struct _MemBlk *hashPrev;
|
struct _MemBlk *hashPrev;
|
||||||
struct _MemBlk *hashNext;
|
struct _MemBlk *hashNext;
|
||||||
struct _MemBlk *lruPrev;
|
struct _MemBlk *lruPrev;
|
||||||
struct _MemBlk *lruNext;
|
struct _MemBlk *lruNext;
|
||||||
}MemBlk;
|
} MemBlk;
|
||||||
|
|
||||||
typedef MemBlk LruQueueDummyHead;
|
typedef MemBlk LruQueueDummyHead;
|
||||||
typedef MemBlk HashQueueDummyHead;
|
typedef MemBlk HashQueueDummyHead;
|
||||||
|
|
||||||
/* hash directory array in every cache */
|
/* hash directory array in every cache */
|
||||||
typedef struct _HashDirectory
|
typedef struct _HashDirectory {
|
||||||
{
|
|
||||||
HashQueueDummyHead hashHead;
|
HashQueueDummyHead hashHead;
|
||||||
}HashDirectory;
|
} HashDirectory;
|
||||||
|
|
||||||
/* The structure is description of Cache
|
/* The structure is description of Cache
|
||||||
blkSize : the size of each block in cache(in byte)
|
blkSize : the size of each block in cache(in byte)
|
||||||
@@ -88,14 +85,12 @@ typedef struct _HashDirectory
|
|||||||
*hashDir : the hash directory pointer
|
*hashDir : the hash directory pointer
|
||||||
lruQueueDummyHead : head node of lru queue
|
lruQueueDummyHead : head node of lru queue
|
||||||
makeHashKeyFunc : the function which make hash key */
|
makeHashKeyFunc : the function which make hash key */
|
||||||
typedef struct cache
|
typedef struct _FontCache {
|
||||||
{
|
|
||||||
/* Information about font */
|
/* Information about font */
|
||||||
char family[LEN_FONT_NAME + 1];
|
char df_name[LEN_UNIDEVFONT_NAME + 1];
|
||||||
char charset[LEN_FONT_NAME + 1];
|
int style;
|
||||||
DWORD style;
|
|
||||||
int fontsize;
|
int fontsize;
|
||||||
|
int rotation;
|
||||||
int refers;
|
int refers;
|
||||||
int blkSize;
|
int blkSize;
|
||||||
int nBlk;
|
int nBlk;
|
||||||
@@ -105,7 +100,7 @@ typedef struct cache
|
|||||||
HashDirectory *hashDir;
|
HashDirectory *hashDir;
|
||||||
LruQueueDummyHead lruQueueDummyHead;
|
LruQueueDummyHead lruQueueDummyHead;
|
||||||
MakeHashKeyFunc makeHashKeyFunc;
|
MakeHashKeyFunc makeHashKeyFunc;
|
||||||
}cache_t;
|
} FontCache;
|
||||||
|
|
||||||
/* Least-Recently-Used-Order
|
/* Least-Recently-Used-Order
|
||||||
global cache LRU queue */
|
global cache LRU queue */
|
||||||
@@ -113,7 +108,7 @@ typedef struct _CacheQueueNode
|
|||||||
{
|
{
|
||||||
/* hold global cache queue
|
/* hold global cache queue
|
||||||
max cache node maybe 10 */
|
max cache node maybe 10 */
|
||||||
cache_t cache;
|
FontCache cache;
|
||||||
struct _CacheQueueNode *prevCache;
|
struct _CacheQueueNode *prevCache;
|
||||||
struct _CacheQueueNode *nextCache;
|
struct _CacheQueueNode *nextCache;
|
||||||
}CacheQueueNode;
|
}CacheQueueNode;
|
||||||
@@ -126,8 +121,7 @@ typedef struct _CacheQueueNode
|
|||||||
cacheSize : each cache's size(in BYTE and
|
cacheSize : each cache's size(in BYTE and
|
||||||
everyone has the same size!)
|
everyone has the same size!)
|
||||||
nCache : how many cache Now!! */
|
nCache : how many cache Now!! */
|
||||||
struct _CacheSystem
|
struct _CacheSystem {
|
||||||
{
|
|
||||||
CacheQueueNode queueDummyHead;
|
CacheQueueNode queueDummyHead;
|
||||||
|
|
||||||
int maxCache;
|
int maxCache;
|
||||||
@@ -152,7 +146,7 @@ AppendCache(CacheQueueNode *new)
|
|||||||
|
|
||||||
/* create a new LRU-Queue. */
|
/* create a new LRU-Queue. */
|
||||||
static int
|
static int
|
||||||
CreateCacheLruQueue(cache_t *cache, int nblk)
|
CreateCacheLruQueue(FontCache *cache, int nblk)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
MemBlk *blk;
|
MemBlk *blk;
|
||||||
@@ -224,7 +218,7 @@ InitCache(CacheQueueNode *new, int ndir, int nblock)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
LruQueueBufferSplit(cache_t *cache, int bufsize)
|
LruQueueBufferSplit(FontCache *cache, int bufsize)
|
||||||
{
|
{
|
||||||
MemBlk *blk;
|
MemBlk *blk;
|
||||||
unsigned char *buff;
|
unsigned char *buff;
|
||||||
@@ -239,7 +233,7 @@ LruQueueBufferSplit(cache_t *cache, int bufsize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DestroyCache(cache_t *cache)
|
DestroyCache(FontCache *cache)
|
||||||
{
|
{
|
||||||
if (cache->hashDir != NULL) {
|
if (cache->hashDir != NULL) {
|
||||||
free(cache->hashDir);
|
free(cache->hashDir);
|
||||||
@@ -328,7 +322,7 @@ GetCache(int nblock, int ndir)
|
|||||||
lru-queue and also Hash queue(anywhere in hash q).
|
lru-queue and also Hash queue(anywhere in hash q).
|
||||||
Relink the lru queue and hash queue */
|
Relink the lru queue and hash queue */
|
||||||
static MemBlk *
|
static MemBlk *
|
||||||
PickOffBlk(cache_t *cache)
|
PickOffBlk(FontCache *cache)
|
||||||
{
|
{
|
||||||
MemBlk *blk;
|
MemBlk *blk;
|
||||||
|
|
||||||
@@ -355,7 +349,7 @@ PickOffBlk(cache_t *cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
/* first, append the blcok at the end of the
|
||||||
lru-queue. */
|
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)
|
*size : if found the data, how long is the data(return val)
|
||||||
reutrn = pointer to the data */
|
reutrn = pointer to the data */
|
||||||
TTFCACHEINFO *
|
TTFCACHEINFO *
|
||||||
__mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
|
__mg_ttc_search(HCACHE hCache, Uchar32 unicode, int *size)
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
CacheQueueNode *ca;
|
CacheQueueNode *ca;
|
||||||
@@ -402,7 +396,8 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
|
|||||||
|
|
||||||
for ( ; blk != &(ca->cache.hashDir[key].hashHead);
|
for ( ; blk != &(ca->cache.hashDir[key].hashHead);
|
||||||
blk = blk->hashNext) {
|
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
|
/* If found the blk, we should pick off it
|
||||||
and link it at the end of LRU-q */
|
and link it at the end of LRU-q */
|
||||||
*size = blk->len;
|
*size = blk->len;
|
||||||
@@ -412,17 +407,18 @@ __mg_ttc_search(HCACHE hCache, unsigned short unicode, int *size)
|
|||||||
blk->lruPrev = ca->cache.lruQueueDummyHead.lruPrev;
|
blk->lruPrev = ca->cache.lruQueueDummyHead.lruPrev;
|
||||||
(ca->cache.lruQueueDummyHead.lruPrev)->lruNext = blk;
|
(ca->cache.lruQueueDummyHead.lruPrev)->lruNext = blk;
|
||||||
ca->cache.lruQueueDummyHead.lruPrev = blk;
|
ca->cache.lruQueueDummyHead.lruPrev = blk;
|
||||||
return blk->data;
|
return tci;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add data into a speicial cache
|
/* add data into the specific cache
|
||||||
hCache : which cache ,
|
hCache : which cache ,
|
||||||
*data : your data pointer
|
*data : your data pointer
|
||||||
size : your data's bytes
|
size : your data's bytes
|
||||||
key : hash key of your data */
|
key : hash key of your data
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
__mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size)
|
__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) {
|
if (ca->cache.blkSize < size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
key = ca->cache.makeHashKeyFunc(*(unsigned short *)data);
|
key = ca->cache.makeHashKeyFunc(data->unicode);
|
||||||
|
|
||||||
/* pick off a block from lru queue */
|
/* pick off a block from lru queue */
|
||||||
if ((blk = PickOffBlk(&ca->cache)) == NULL) {
|
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.
|
/* create a cache for a font instance.
|
||||||
nblk : how many block in the cache.
|
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
|
ndir : how many hash entries in the cache
|
||||||
makeHashKey : the function which make the hash key */
|
makeHashKey : the function which make the hash key */
|
||||||
HCACHE
|
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)
|
int nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey)
|
||||||
{
|
{
|
||||||
CacheQueueNode *temp;
|
CacheQueueNode *temp;
|
||||||
if (family == NULL || charset == NULL || makeHashKey == NULL) {
|
if (df_name == NULL || makeHashKey == NULL) {
|
||||||
return (HCACHE)(0);
|
return (HCACHE)(0);
|
||||||
}
|
}
|
||||||
if (nblk <= 0 || blksize <= 0 || size <= 0 || ndir <= 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);
|
return (HCACHE)(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(temp->cache.family, family, LEN_FONT_NAME);
|
memset(temp->cache.df_name, 0, LEN_UNIDEVFONT_NAME + 1);
|
||||||
strncpy(temp->cache.charset, charset, LEN_FONT_NAME);
|
strncpy(temp->cache.df_name, df_name, LEN_UNIDEVFONT_NAME);
|
||||||
temp->cache.style = style;
|
temp->cache.style = style & FS_RENDER_MASK;
|
||||||
temp->cache.fontsize = size;
|
temp->cache.fontsize = size;
|
||||||
|
temp->cache.rotation = rotation;
|
||||||
temp->cache.blkSize = blksize;
|
temp->cache.blkSize = blksize;
|
||||||
temp->cache.nBlk = nblk;
|
temp->cache.nBlk = nblk;
|
||||||
temp->cache.nDir = ndir;
|
temp->cache.nDir = ndir;
|
||||||
@@ -573,10 +570,8 @@ __mg_ttc_sys_deinit(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HCACHE
|
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;
|
CacheQueueNode *p;
|
||||||
|
|
||||||
@@ -584,28 +579,18 @@ __mg_ttc_is_exist(char *family, char *charset, DWORD style, int size)
|
|||||||
return (HCACHE)0;
|
return (HCACHE)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If can not match font name*/
|
|
||||||
p = __mg_globalCache.queueDummyHead.nextCache;
|
p = __mg_globalCache.queueDummyHead.nextCache;
|
||||||
while (p != &__mg_globalCache.queueDummyHead) {
|
while (p != &__mg_globalCache.queueDummyHead) {
|
||||||
if (strncmp(p->cache.family, family, LEN_FONT_NAME) == 0) {
|
if (strncmp(p->cache.df_name, df_name, LEN_UNIDEVFONT_NAME) == 0
|
||||||
if (strncmp(p->cache.charset, charset, LEN_FONT_NAME) == 0) {
|
&& p->cache.style == (style & FS_RENDER_MASK)
|
||||||
if (p->cache.fontsize == size) {
|
&& p->cache.fontsize == size
|
||||||
int s = style & 0x000000FF;
|
&& p->cache.rotation == rotation) {
|
||||||
if ((s == FS_WEIGHT_BOOK || s == FS_WEIGHT_DEMIBOLD || s == FS_WEIGHT_SUBPIXEL) &&
|
return (HCACHE) p;
|
||||||
(p->cache.style == FS_WEIGHT_BOOK || p->cache.style == FS_WEIGHT_DEMIBOLD ||
|
|
||||||
p->cache.style == FS_WEIGHT_SUBPIXEL)) {
|
|
||||||
return (HCACHE) p;
|
|
||||||
}
|
|
||||||
if ((s != FS_WEIGHT_BOOK && s != FS_WEIGHT_DEMIBOLD && s != FS_WEIGHT_SUBPIXEL) &&
|
|
||||||
(p->cache.style != FS_WEIGHT_BOOK && p->cache.style != FS_WEIGHT_DEMIBOLD &&
|
|
||||||
p->cache.style != FS_WEIGHT_SUBPIXEL)) {
|
|
||||||
return (HCACHE) p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p = p->nextCache;
|
p = p->nextCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (HCACHE)0;
|
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;
|
int i, j, k;
|
||||||
MemBlk *ptr;
|
MemBlk *ptr;
|
||||||
#if 0
|
#if 0
|
||||||
DP(("&cache = %p\n", cache));
|
DP(("&cache = %p\n", cache));
|
||||||
DP(("cache.family = %s\n", cache->family));
|
DP(("cache.df_name = %s\n", cache->df_name));
|
||||||
DP(("cache.charset = %s\n", cache->charset));
|
|
||||||
DP(("cache.style = %d\n", cache->style));
|
|
||||||
DP(("cache.fontsize = %d\n", cache->fontsize));
|
DP(("cache.fontsize = %d\n", cache->fontsize));
|
||||||
DP(("cache.blkSize = %d\n", cache->blkSize));
|
DP(("cache.blkSize = %d\n", cache->blkSize));
|
||||||
DP(("cache.refers = %d\n", cache->refers));
|
DP(("cache.refers = %d\n", cache->refers));
|
||||||
|
|||||||
+186
-30
@@ -42,6 +42,9 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define DEBUG
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "minigui.h"
|
#include "minigui.h"
|
||||||
@@ -70,7 +73,7 @@ int fontConvertFontType (const char* type)
|
|||||||
if (strcasecmp (type, FONT_TYPE_NAME_SCALE_T1F) == 0)
|
if (strcasecmp (type, FONT_TYPE_NAME_SCALE_T1F) == 0)
|
||||||
return FONT_TYPE_SCALE_T1F;
|
return FONT_TYPE_SCALE_T1F;
|
||||||
if (strcasecmp (type, FONT_TYPE_NAME_ALL) == 0)
|
if (strcasecmp (type, FONT_TYPE_NAME_ALL) == 0)
|
||||||
return FONT_TYPE_ALL;
|
return FONT_TYPE_ANY;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -96,7 +99,7 @@ BOOL fontGetTypeNameFromName (const char* name, char* type)
|
|||||||
|
|
||||||
int fontGetFontTypeFromName (const char* name)
|
int fontGetFontTypeFromName (const char* name)
|
||||||
{
|
{
|
||||||
char type [LEN_FONT_NAME + 1];
|
char type [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
|
|
||||||
if (!fontGetTypeNameFromName (name, type))
|
if (!fontGetTypeNameFromName (name, type))
|
||||||
return -1;
|
return -1;
|
||||||
@@ -114,8 +117,8 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
|
|||||||
if (*(++family_part) == '\0')
|
if (*(++family_part) == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
while (family_part [i] && i <= LEN_FONT_NAME) {
|
while (family_part [i] && i <= LEN_LOGFONT_FAMILY_FILED) {
|
||||||
if (family_part [i] == '-') {
|
if (family_part [i] == '-'/* || family_part [i] == ',' */) {
|
||||||
family [i] = '\0';
|
family [i] = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -127,42 +130,155 @@ BOOL fontGetFamilyFromName (const char* name, char* family)
|
|||||||
return TRUE;
|
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 fontConvertStyle (const char* style_part)
|
||||||
{
|
{
|
||||||
DWORD style = 0;
|
DWORD style = 0;
|
||||||
|
|
||||||
|
style &= ~FS_WEIGHT_MASK;
|
||||||
switch (style_part [0]) {
|
switch (style_part [0]) {
|
||||||
case FONT_WEIGHT_BLACK:
|
case FONT_WEIGHT_BLACK:
|
||||||
style |= FS_WEIGHT_BLACK;
|
style |= FS_WEIGHT_BLACK;
|
||||||
break;
|
break;
|
||||||
|
case FONT_WEIGHT_EXTRA_BOLD:
|
||||||
|
style |= FS_WEIGHT_EXTRA_BOLD;
|
||||||
|
break;
|
||||||
case FONT_WEIGHT_BOLD:
|
case FONT_WEIGHT_BOLD:
|
||||||
style |= FS_WEIGHT_BOLD;
|
style |= FS_WEIGHT_BOLD;
|
||||||
break;
|
break;
|
||||||
|
/* deprecated since v3.4.0
|
||||||
case FONT_WEIGHT_BOOK:
|
case FONT_WEIGHT_BOOK:
|
||||||
style |= FS_WEIGHT_BOOK;
|
style |= FS_WEIGHT_BOOK;
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
case FONT_WEIGHT_DEMIBOLD:
|
case FONT_WEIGHT_DEMIBOLD:
|
||||||
style |= FS_WEIGHT_DEMIBOLD;
|
style |= FS_WEIGHT_DEMIBOLD;
|
||||||
break;
|
break;
|
||||||
case FONT_WEIGHT_LIGHT:
|
|
||||||
style |= FS_WEIGHT_LIGHT;
|
|
||||||
break;
|
|
||||||
case FONT_WEIGHT_MEDIUM:
|
case FONT_WEIGHT_MEDIUM:
|
||||||
style |= FS_WEIGHT_MEDIUM;
|
style |= FS_WEIGHT_MEDIUM;
|
||||||
break;
|
break;
|
||||||
case FONT_WEIGHT_REGULAR:
|
case FONT_WEIGHT_REGULAR:
|
||||||
style |= FS_WEIGHT_REGULAR;
|
style |= FS_WEIGHT_REGULAR;
|
||||||
break;
|
break;
|
||||||
case FONT_WEIGHT_SUBPIXEL:
|
case FONT_WEIGHT_NORMAL:
|
||||||
style |= FS_WEIGHT_SUBPIXEL;
|
style |= FS_WEIGHT_NORMAL;
|
||||||
break;
|
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:
|
case FONT_WEIGHT_ALL:
|
||||||
style |= FS_WEIGHT_MASK;
|
style |= FS_WEIGHT_MASK;
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
case FONT_WEIGHT_ANY:
|
||||||
default:
|
default:
|
||||||
return 0xFFFFFFFF;
|
style |= FS_WEIGHT_ANY;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
style &= ~FS_SLANT_MASK;
|
||||||
switch (style_part [1]) {
|
switch (style_part [1]) {
|
||||||
case FONT_SLANT_ITALIC:
|
case FONT_SLANT_ITALIC:
|
||||||
style |= FS_SLANT_ITALIC;
|
style |= FS_SLANT_ITALIC;
|
||||||
@@ -173,13 +289,13 @@ DWORD fontConvertStyle (const char* style_part)
|
|||||||
case FONT_SLANT_ROMAN:
|
case FONT_SLANT_ROMAN:
|
||||||
style |= FS_SLANT_ROMAN;
|
style |= FS_SLANT_ROMAN;
|
||||||
break;
|
break;
|
||||||
case FONT_SLANT_ALL:
|
case FONT_SLANT_ANY:
|
||||||
style |= FS_SLANT_MASK;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0xFFFFFFFF;
|
style |= FS_SLANT_ANY;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
style &= ~FS_FLIP_MASK;
|
||||||
switch (style_part [2]) {
|
switch (style_part [2]) {
|
||||||
case FONT_FLIP_HORZ:
|
case FONT_FLIP_HORZ:
|
||||||
style |= FS_FLIP_HORZ;
|
style |= FS_FLIP_HORZ;
|
||||||
@@ -191,9 +307,11 @@ DWORD fontConvertStyle (const char* style_part)
|
|||||||
style |= FS_FLIP_HORZVERT;
|
style |= FS_FLIP_HORZVERT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
//style |= FS_FLIP_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
style &= ~FS_OTHER_MASK;
|
||||||
switch (style_part [3]) {
|
switch (style_part [3]) {
|
||||||
case FONT_OTHER_AUTOSCALE:
|
case FONT_OTHER_AUTOSCALE:
|
||||||
style |= FS_OTHER_AUTOSCALE;
|
style |= FS_OTHER_AUTOSCALE;
|
||||||
@@ -207,16 +325,53 @@ DWORD fontConvertStyle (const char* style_part)
|
|||||||
case FONT_OTHER_TTFNOCACHEKERN:
|
case FONT_OTHER_TTFNOCACHEKERN:
|
||||||
style |= FS_OTHER_TTFNOCACHEKERN;
|
style |= FS_OTHER_TTFNOCACHEKERN;
|
||||||
break;
|
break;
|
||||||
case FONT_OTHER_LCDPORTRAIT:
|
|
||||||
style |= FS_OTHER_LCDPORTRAIT;
|
|
||||||
break;
|
|
||||||
case FONT_OTHER_LCDPORTRAITKERN:
|
|
||||||
style |= FS_OTHER_LCDPORTRAITKERN;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
|
//style |= FS_OTHER_NONE;
|
||||||
break;
|
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]) {
|
switch (style_part [4]) {
|
||||||
case FONT_UNDERLINE_LINE:
|
case FONT_UNDERLINE_LINE:
|
||||||
style |= FS_UNDERLINE_LINE;
|
style |= FS_UNDERLINE_LINE;
|
||||||
@@ -244,6 +399,7 @@ DWORD fontConvertStyle (const char* style_part)
|
|||||||
default:
|
default:
|
||||||
return 0xFFFFFFFF;
|
return 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
@@ -291,7 +447,7 @@ int fontGetWidthFromName (const char* name)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char* width_part = name;
|
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++) {
|
for (i = 0; i < NR_LOOP_FOR_WIDTH; i++) {
|
||||||
if ((width_part = strchr (width_part, '-')) == NULL)
|
if ((width_part = strchr (width_part, '-')) == NULL)
|
||||||
@@ -322,7 +478,7 @@ int fontGetHeightFromName (const char* name)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char* height_part = name;
|
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++) {
|
for (i = 0; i < NR_LOOP_FOR_HEIGHT; i++) {
|
||||||
if ((height_part = strchr (height_part, '-')) == NULL)
|
if ((height_part = strchr (height_part, '-')) == NULL)
|
||||||
@@ -369,8 +525,8 @@ BOOL fontGetCharsetFromName (const char* name, char* charset)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy (charset, charset_part, LEN_FONT_NAME);
|
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
|
||||||
charset [LEN_FONT_NAME] = '\0';
|
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,8 +548,8 @@ BOOL fontGetCompatibleCharsetFromName (const char* name, char* charset)
|
|||||||
if (*(++charset_part) == '\0')
|
if (*(++charset_part) == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
strncpy (charset, charset_part, LEN_FONT_NAME);
|
strncpy (charset, charset_part, LEN_LOGFONT_NAME_FIELD);
|
||||||
charset [LEN_FONT_NAME] = '\0';
|
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,8 +607,8 @@ BOOL charsetGetSpecificCharset (const char* charsets, int _index, char* charset)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy (charset, charsets, LEN_FONT_NAME);
|
strncpy (charset, charsets, LEN_LOGFONT_NAME_FIELD);
|
||||||
charset [LEN_FONT_NAME] = '\0';
|
charset [LEN_LOGFONT_NAME_FIELD] = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-12
@@ -65,7 +65,7 @@ static TT_Engine ttf_engine; /* The ONLY freetype engine */
|
|||||||
static BYTE virtual_palette [] = {0, 32, 64, 128, 255};
|
static BYTE virtual_palette [] = {0, 32, 64, 128, 255};
|
||||||
|
|
||||||
/************************ Create/Destroy FreeType font ***********************/
|
/************************ 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 i, n;
|
||||||
unsigned short platform, encoding;
|
unsigned short platform, encoding;
|
||||||
@@ -144,7 +144,7 @@ error_after_create_info:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unload_font_data (void* data)
|
static void unload_font_data (DEVFONT* devfont, void* data)
|
||||||
{
|
{
|
||||||
TTFINSTANCEINFO* ttf_inst_info = (TTFINSTANCEINFO*)data;
|
TTFINSTANCEINFO* ttf_inst_info = (TTFINSTANCEINFO*)data;
|
||||||
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
|
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
|
||||||
@@ -243,7 +243,7 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
|
|||||||
return kernval;
|
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)
|
if (logfont->style & FS_WEIGHT_BOOK)
|
||||||
return DEVFONTGLYPHTYPE_GREYBMP;
|
return DEVFONTGLYPHTYPE_GREYBMP;
|
||||||
@@ -263,10 +263,13 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
return ttf_inst_info->height;
|
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;
|
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;
|
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
|
/* call this function before getting the bitmap/pixmap of the char
|
||||||
* to get the bbox of the char */
|
* to get the bbox of the char */
|
||||||
static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
const Glyph32 glyph_value,
|
Glyph32 glyph_value,
|
||||||
int* px, int* py, int* pwidth, int* pheight)
|
int* px, int* py, int* pwidth, int* pheight)
|
||||||
{
|
{
|
||||||
TT_UShort uni_char;
|
TT_UShort uni_char;
|
||||||
@@ -304,6 +307,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
TT_Glyph_Metrics metrics;
|
TT_Glyph_Metrics metrics;
|
||||||
TT_BBox bbox;
|
TT_BBox bbox;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
||||||
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
|
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 */
|
/* call this function to get the bitmap/pixmap of the char */
|
||||||
static const void*
|
static const void*
|
||||||
char_bitmap_pixmap (LOGFONT* logfont, DEVFONT* devfont,
|
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_Raster_Map Raster;
|
||||||
TT_Error error;
|
TT_Error error;
|
||||||
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
/* now allocate the raster bitmap */
|
/* now allocate the raster bitmap */
|
||||||
Raster.rows = ttf_inst_info->cur_height;
|
Raster.rows = ttf_inst_info->cur_height;
|
||||||
Raster.width = ttf_inst_info->cur_width;
|
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,
|
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;
|
if (scale) *scale = 1;
|
||||||
return char_bitmap_pixmap (logfont, devfont, glyph_value, pitch, FALSE);
|
return char_bitmap_pixmap (logfont, devfont, glyph_value, pitch, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
|
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;
|
if (scale) *scale = 1;
|
||||||
return char_bitmap_pixmap (logfont, devfont, glyph_value, pitch, TRUE);
|
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
|
/* call this function after getting the bitmap/pixmap of the char
|
||||||
* to get the advance of the char */
|
* to get the advance of the char */
|
||||||
static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
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;
|
TT_Pos vec_x, vec_y;
|
||||||
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
||||||
TTFGLYPHINFO* ttf_glyph_info = TTF_GLYPH_INFO_P (devfont);
|
TTFGLYPHINFO* ttf_glyph_info = TTF_GLYPH_INFO_P (devfont);
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (ttf_inst_info->rotation) {
|
if (ttf_inst_info->rotation) {
|
||||||
vec_x = ttf_inst_info->cur_advance;
|
vec_x = ttf_inst_info->cur_advance;
|
||||||
vec_y = 0;
|
vec_y = 0;
|
||||||
@@ -621,7 +629,7 @@ static DEVFONT* new_instance (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
memcpy (new_devfont, devfont, sizeof (DEVFONT));
|
memcpy (new_devfont, devfont, sizeof (DEVFONT));
|
||||||
|
|
||||||
if (need_sbc_font && devfont->charset_ops->bytes_maxlen_char > 1) {
|
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);
|
fontGetCompatibleCharsetFromName (devfont->name, charset);
|
||||||
new_devfont->charset_ops = GetCharsetOpsEx (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);
|
TTFINSTANCEINFO* ttf_inst_info = TTF_INST_INFO_P (devfont);
|
||||||
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
|
TTFGLYPHINFO* ttf_glyph_info = ttf_inst_info->ttf_glyph_info;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -771,7 +780,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
|||||||
}
|
}
|
||||||
/**************************** Global data ************************************/
|
/**************************** Global data ************************************/
|
||||||
FONTOPS __mg_ttf_ops = {
|
FONTOPS __mg_ttf_ops = {
|
||||||
get_glyph_type,
|
get_glyph_bmptype,
|
||||||
get_ave_width,
|
get_ave_width,
|
||||||
get_max_width,
|
get_max_width,
|
||||||
get_font_height,
|
get_font_height,
|
||||||
|
|||||||
+353
-220
File diff suppressed because it is too large
Load Diff
+23
-19
@@ -40,6 +40,14 @@
|
|||||||
#ifndef GUI_FREETYP2_H
|
#ifndef GUI_FREETYP2_H
|
||||||
#define 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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
@@ -54,6 +62,7 @@ extern "C" {
|
|||||||
#include FT_CACHE_MANAGER_H
|
#include FT_CACHE_MANAGER_H
|
||||||
#include FT_TRIGONOMETRY_H
|
#include FT_TRIGONOMETRY_H
|
||||||
#include FT_IMAGE_H
|
#include FT_IMAGE_H
|
||||||
|
#include FT_TRUETYPE_TABLES_H
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define _MGFONT_TTF_CACHE 1
|
#define _MGFONT_TTF_CACHE 1
|
||||||
@@ -62,14 +71,13 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MGFONT_TTF_CACHE
|
#ifdef _MGFONT_TTF_CACHE
|
||||||
typedef unsigned long HCACHE;
|
typedef void* HCACHE;
|
||||||
typedef int (* MakeHashKeyFunc)(unsigned short unicode);
|
typedef int (* MakeHashKeyFunc)(Uchar32 unicode);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct tagFTFACEINFO {
|
typedef struct tagFTFACEINFO {
|
||||||
#ifdef _MGFONT_TTF_CACHE
|
#ifdef _MGFONT_TTF_CACHE
|
||||||
/*should be MAX_PATH*/
|
char* filepathname;
|
||||||
char filepathname[256];
|
|
||||||
int face_index;
|
int face_index;
|
||||||
int cmap_index;
|
int cmap_index;
|
||||||
#else
|
#else
|
||||||
@@ -114,38 +122,34 @@ typedef struct tagFTINSTANCEINFO {
|
|||||||
#define _TTF_HASH_NDIR 37
|
#define _TTF_HASH_NDIR 37
|
||||||
|
|
||||||
typedef struct tagTTFCACHEINFO {
|
typedef struct tagTTFCACHEINFO {
|
||||||
unsigned short unicode;
|
Uchar32 unicode;
|
||||||
short glyph_code;
|
FT_UInt glyph_code;
|
||||||
FT_Vector advance;
|
FT_Vector advance;
|
||||||
FT_BBox bbox;
|
FT_BBox bbox;
|
||||||
FT_Vector delta;
|
FT_Vector delta;
|
||||||
int flag;
|
int flag;
|
||||||
int pitch;
|
int pitch;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
void *bitmap;
|
void *bitmap;
|
||||||
} TTFCACHEINFO, *PTTFCACHEINFO;
|
} 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 nblk, int blksize, int ndir, MakeHashKeyFunc makeHashKey);
|
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 int __mg_ttc_write(HCACHE hCache, TTFCACHEINFO *data, int size);
|
||||||
extern void __mg_ttc_release(HCACHE hCache);
|
extern void __mg_ttc_release(HCACHE hCache);
|
||||||
extern int __mg_ttc_sys_init(int maxCache, int cacheSize);
|
extern int __mg_ttc_sys_init(int maxCache, int cacheSize);
|
||||||
extern void __mg_ttc_sys_deinit(void);
|
extern void __mg_ttc_sys_deinit(void);
|
||||||
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache,
|
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache,
|
||||||
unsigned short unicode, int *size);
|
Uchar32 unicode, int *size);
|
||||||
extern HCACHE __mg_ttc_is_exist(char *family, char *charset,
|
|
||||||
DWORD style, int size);
|
|
||||||
extern void __mg_ttc_refer(HCACHE hCache);
|
extern void __mg_ttc_refer(HCACHE hCache);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef TTF_DBG
|
|
||||||
|
|
||||||
#ifndef TTF_DBG
|
|
||||||
#define DP(x)
|
|
||||||
#else
|
|
||||||
#define DP(x) do { printf x; } while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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__ */
|
|
||||||
@@ -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 */
|
||||||
|
|
||||||
+373
-312
File diff suppressed because it is too large
Load Diff
+41
-32
@@ -154,7 +154,7 @@ static void clear_glyph_tree (QPF_GLYPHTREE* tree)
|
|||||||
free (tree->more);
|
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;
|
FILE* fp = NULL;
|
||||||
uchar* data;
|
uchar* data;
|
||||||
@@ -222,7 +222,7 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unload_font_data (void* data)
|
static void unload_font_data (DEVFONT* devfont, void* data)
|
||||||
{
|
{
|
||||||
QPFINFO* qpf_info = (QPFINFO*)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_glyph = {&def_metrics, def_bitmap};
|
||||||
static QPF_GLYPH def_smooth_glyph = {&def_smooth_metrics, def_smooth_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)
|
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH)
|
||||||
return DEVFONTGLYPHTYPE_GREYBMP;
|
return DEVFONTGLYPHTYPE_GREYBMP;
|
||||||
@@ -302,7 +302,7 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
* GET_DEVFONT_SCALE (logfont, 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 +
|
int height = QPFONT_INFO_P (devfont)->fm->ascent +
|
||||||
QPFONT_INFO_P (devfont)->fm->descent;
|
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)
|
if (logfont->style & FS_OTHER_AUTOSCALE)
|
||||||
scale = font_GetBestScaleFactor (height, expect);
|
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;
|
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,
|
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;
|
unsigned int uc16;
|
||||||
QPF_GLYPH* glyph;
|
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);
|
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
else
|
||||||
uc16 = glyph_value;
|
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);
|
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||||
|
|
||||||
if (glyph == NULL) {
|
if (glyph == NULL) {
|
||||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||||
unsigned char ascii_ch = uc16;
|
unsigned char ascii_ch = uc16;
|
||||||
return logfont->sbc_devfont->font_ops->get_glyph_monobitmap (logfont,
|
return logfont->devfonts[0]->font_ops->get_glyph_monobitmap (logfont,
|
||||||
logfont->sbc_devfont, ascii_ch, pitch, scale);
|
logfont->devfonts[0], ascii_ch, sz, pitch, scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
glyph = &def_glyph;
|
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,
|
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;
|
unsigned int uc16;
|
||||||
QPF_GLYPH* glyph;
|
QPF_GLYPH* glyph;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (scale)
|
if (scale)
|
||||||
*scale = GET_DEVFONT_SCALE (logfont, devfont);
|
*scale = GET_DEVFONT_SCALE (logfont, devfont);
|
||||||
|
|
||||||
@@ -400,6 +403,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
QPF_GLYPH* glyph;
|
QPF_GLYPH* glyph;
|
||||||
unsigned short scale = GET_DEVFONT_SCALE (logfont, devfont);
|
unsigned short scale = GET_DEVFONT_SCALE (logfont, devfont);
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -408,21 +412,21 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||||
|
|
||||||
if (glyph == NULL) {
|
if (glyph == NULL) {
|
||||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||||
unsigned char ascii_ch = uc16;
|
unsigned char ascii_ch = uc16;
|
||||||
if (logfont->sbc_devfont->font_ops->get_glyph_bbox) {
|
if (logfont->devfonts[0]->font_ops->get_glyph_bbox) {
|
||||||
return logfont->sbc_devfont->font_ops->get_glyph_bbox (logfont,
|
return logfont->devfonts[0]->font_ops->get_glyph_bbox (logfont,
|
||||||
logfont->sbc_devfont, ascii_ch,
|
logfont->devfonts[0], ascii_ch,
|
||||||
px, py, pwidth, pheight);
|
px, py, pwidth, pheight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int width, height, ascent;
|
int width, height, ascent;
|
||||||
logfont->sbc_devfont->font_ops->get_glyph_advance
|
logfont->devfonts[0]->font_ops->get_glyph_advance
|
||||||
(logfont, logfont->sbc_devfont, glyph_value, &width, 0);
|
(logfont, logfont->devfonts[0], glyph_value, &width, 0);
|
||||||
height = logfont->sbc_devfont->font_ops->get_font_height
|
height = logfont->devfonts[0]->font_ops->get_font_height
|
||||||
(logfont, logfont->sbc_devfont);
|
(logfont, logfont->devfonts[0]);
|
||||||
ascent = logfont->sbc_devfont->font_ops->get_font_ascent
|
ascent = logfont->devfonts[0]->font_ops->get_font_ascent
|
||||||
(logfont, logfont->sbc_devfont);
|
(logfont, logfont->devfonts[0]);
|
||||||
|
|
||||||
if (pwidth) *pwidth = width;
|
if (pwidth) *pwidth = width;
|
||||||
if (pheight) *pheight = height;
|
if (pheight) *pheight = height;
|
||||||
@@ -452,6 +456,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
QPF_GLYPH* glyph;
|
QPF_GLYPH* glyph;
|
||||||
int advance;
|
int advance;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -460,11 +465,11 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||||
|
|
||||||
if (glyph == NULL) {
|
if (glyph == NULL) {
|
||||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) { /* ASCII */
|
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) { /* ASCII */
|
||||||
unsigned char ascii_ch = uc16;
|
unsigned char ascii_ch = uc16;
|
||||||
if (logfont->sbc_devfont->font_ops->get_glyph_advance) {
|
if (logfont->devfonts[0]->font_ops->get_glyph_advance) {
|
||||||
return logfont->sbc_devfont->font_ops->
|
return logfont->devfonts[0]->font_ops->
|
||||||
get_glyph_advance (logfont, logfont->sbc_devfont,
|
get_glyph_advance (logfont, logfont->devfonts[0],
|
||||||
ascii_ch, px, py);
|
ascii_ch, px, py);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,9 +487,12 @@ static DEVFONT* new_instance (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
BOOL need_sbc_font)
|
BOOL need_sbc_font)
|
||||||
{
|
{
|
||||||
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH) {
|
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH) {
|
||||||
logfont->style &= ~FS_WEIGHT_SUBPIXEL;
|
logfont->style &= ~FS_RENDER_MASK;
|
||||||
logfont->style |= FS_WEIGHT_BOOK;
|
logfont->style |= FS_RENDER_GREY;
|
||||||
logfont->style &= ~FS_WEIGHT_LIGHT;
|
}
|
||||||
|
else {
|
||||||
|
logfont->style &= ~FS_RENDER_MASK;
|
||||||
|
logfont->style |= FS_RENDER_MONO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return devfont;
|
return devfont;
|
||||||
@@ -495,6 +503,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
|
|||||||
unsigned int uc16;
|
unsigned int uc16;
|
||||||
QPF_GLYPH* glyph;
|
QPF_GLYPH* glyph;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
uc16 = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
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);
|
glyph = get_glyph (QPFONT_INFO_P (devfont)->tree, uc16);
|
||||||
|
|
||||||
if (glyph == NULL) {
|
if (glyph == NULL) {
|
||||||
if (uc16 < 0x80 && logfont->sbc_devfont != devfont) /* ASCII */
|
if (uc16 < 0x80 && logfont->devfonts[0] != devfont) /* ASCII */
|
||||||
return logfont->sbc_devfont->font_ops->is_glyph_existed (logfont,
|
return logfont->devfonts[0]->font_ops->is_glyph_existed (logfont,
|
||||||
logfont->sbc_devfont, glyph_value);
|
logfont->devfonts[0], glyph_value);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -519,7 +528,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
|||||||
|
|
||||||
/**************************** Global data ************************************/
|
/**************************** Global data ************************************/
|
||||||
FONTOPS __mg_qpf_ops = {
|
FONTOPS __mg_qpf_ops = {
|
||||||
get_glyph_type,
|
get_glyph_bmptype,
|
||||||
get_ave_width,
|
get_ave_width,
|
||||||
get_max_width,
|
get_max_width,
|
||||||
get_font_height,
|
get_font_height,
|
||||||
|
|||||||
+13
-15
@@ -65,11 +65,7 @@
|
|||||||
#define RBFONT_INFO(devfont) ((RBFINFO*)(devfont.data))
|
#define RBFONT_INFO(devfont) ((RBFINFO*)(devfont.data))
|
||||||
|
|
||||||
/********************** Load/Unload of raw bitmap font ***********************/
|
/********************** Load/Unload of raw bitmap font ***********************/
|
||||||
#if 0
|
static void* load_font_data (DEVFONT* devfont, const char* font_name, const char* file_name)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
FILE* fp = NULL;
|
FILE* fp = NULL;
|
||||||
RBFINFO* rbf_info = calloc (1, sizeof(RBFINFO));
|
RBFINFO* rbf_info = calloc (1, sizeof(RBFINFO));
|
||||||
@@ -129,7 +125,7 @@ error_load:
|
|||||||
|
|
||||||
/********************** Init/Term of raw bitmap font ***********************/
|
/********************** 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;
|
RBFINFO* rbfinfo = (RBFINFO*)data;
|
||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
@@ -143,7 +139,7 @@ static void unload_font_data (void* data)
|
|||||||
|
|
||||||
/*************** Raw bitmap font operations *********************************/
|
/*************** 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;
|
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);
|
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;
|
int height = RBFONT_INFO_P (devfont)->height;
|
||||||
unsigned short scale = 1;
|
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)
|
if (logfont->style & FS_OTHER_AUTOSCALE)
|
||||||
scale = font_GetBestScaleFactor (height, expect);
|
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;
|
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,
|
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;
|
int bitmap_size;
|
||||||
Glyph32 glyph_tmp = glyph_value;
|
|
||||||
|
|
||||||
if (glyph_tmp >= RBFONT_INFO_P (devfont)->nr_glyphs)
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
glyph_tmp = devfont->charset_ops->def_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)
|
bitmap_size = ((RBFONT_INFO_P (devfont)->width + 7) >> 3)
|
||||||
* RBFONT_INFO_P (devfont)->height;
|
* RBFONT_INFO_P (devfont)->height;
|
||||||
@@ -224,12 +221,13 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
if (scale)
|
if (scale)
|
||||||
*scale = GET_DEVFONT_SCALE (logfont, devfont);
|
*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,
|
static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont,
|
||||||
Glyph32 glyph_value)
|
Glyph32 glyph_value)
|
||||||
{
|
{
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (glyph_value > RBFONT_INFO_P(devfont)->nr_glyphs)
|
if (glyph_value > RBFONT_INFO_P(devfont)->nr_glyphs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else
|
else
|
||||||
@@ -268,7 +266,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
|||||||
|
|
||||||
/**************************** Global data ************************************/
|
/**************************** Global data ************************************/
|
||||||
FONTOPS __mg_rbf_ops = {
|
FONTOPS __mg_rbf_ops = {
|
||||||
get_glyph_type,
|
get_glyph_bmptype,
|
||||||
get_ave_width,
|
get_ave_width,
|
||||||
get_ave_width, // max_width same as ave_width
|
get_ave_width, // max_width same as ave_width
|
||||||
get_font_height,
|
get_font_height,
|
||||||
|
|||||||
+11
-5
@@ -113,7 +113,7 @@ static BOOL load_fonts(void)
|
|||||||
se_dev_fonts = calloc (font_table_size, sizeof (DEVFONT));
|
se_dev_fonts = calloc (font_table_size, sizeof (DEVFONT));
|
||||||
|
|
||||||
for (i = 0; i < font_table_size; i++) {
|
for (i = 0; i < font_table_size; i++) {
|
||||||
char charset[LEN_FONT_NAME + 1];
|
char charset[LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
CHARSETOPS *charset_ops;
|
CHARSETOPS *charset_ops;
|
||||||
const char *font_name;
|
const char *font_name;
|
||||||
int font_id;
|
int font_id;
|
||||||
@@ -158,7 +158,7 @@ static BOOL load_fonts(void)
|
|||||||
if ((nr_charsets = charsetGetCharsetsNumber (charsets)) > 1) {
|
if ((nr_charsets = charsetGetCharsetsNumber (charsets)) > 1) {
|
||||||
int j;
|
int j;
|
||||||
for (j = 1; j < nr_charsets; j++) {
|
for (j = 1; j < nr_charsets; j++) {
|
||||||
char charset [LEN_FONT_NAME + 1];
|
char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
CHARSETOPS* charset_ops;
|
CHARSETOPS* charset_ops;
|
||||||
DEVFONT* new_devfont;
|
DEVFONT* new_devfont;
|
||||||
|
|
||||||
@@ -334,6 +334,7 @@ static int get_glyph_width (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
SeLogFont selogfont;
|
SeLogFont selogfont;
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
||||||
else
|
else
|
||||||
@@ -364,7 +365,7 @@ static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
return logfont->size;
|
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)
|
if (logfont->style & FS_WEIGHT_BOOK)
|
||||||
return DEVFONTGLYPHTYPE_GREYBMP;
|
return DEVFONTGLYPHTYPE_GREYBMP;
|
||||||
@@ -440,6 +441,7 @@ static const void* get_glyph_greybitmap (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
printf("in get_glyph_greybitmap....\n");
|
printf("in get_glyph_greybitmap....\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
||||||
else
|
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,
|
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;
|
seunichar16 wc;
|
||||||
SeLogFont selogfont;
|
SeLogFont selogfont;
|
||||||
@@ -476,6 +478,7 @@ static const void* get_glyph_monobitmap (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
printf("in get_char_bitmap....\n");
|
printf("in get_char_bitmap....\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
||||||
else
|
else
|
||||||
@@ -505,6 +508,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
if(px == 0 && py == 0 && pwidth == 0 && pheight == 0)
|
if(px == 0 && py == 0 && pwidth == 0 && pheight == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
||||||
else
|
else
|
||||||
@@ -534,6 +538,7 @@ static int get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
|
|||||||
SeLogFont selogfont;
|
SeLogFont selogfont;
|
||||||
int x = *px;
|
int x = *px;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if (devfont->charset_ops->conv_to_uc32)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
wc = (*devfont->charset_ops->conv_to_uc32)(glyph_value);
|
||||||
else
|
else
|
||||||
@@ -558,6 +563,7 @@ static BOOL is_glyph_existed (LOGFONT* logfont, DEVFONT* devfont, Glyph32 glyph_
|
|||||||
int uni_char;
|
int uni_char;
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
|
glyph_value = REAL_GLYPH(glyph_value);
|
||||||
if(devfont->charset_ops->conv_to_uc32)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
uni_char = (*devfont->charset_ops->conv_to_uc32) (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -577,7 +583,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
|||||||
|
|
||||||
/**************************** Global data ************************************/
|
/**************************** Global data ************************************/
|
||||||
static FONTOPS scripteasy_font_ops = {
|
static FONTOPS scripteasy_font_ops = {
|
||||||
get_glyph_type,
|
get_glyph_bmptype,
|
||||||
get_ave_width,
|
get_ave_width,
|
||||||
get_max_width,
|
get_max_width,
|
||||||
get_font_height,
|
get_font_height,
|
||||||
|
|||||||
+12
-12
@@ -102,10 +102,10 @@ BOOL mg_InitSysFont (void)
|
|||||||
|
|
||||||
for (i = 0; i < nr_fonts; i++) {
|
for (i = 0; i < nr_fonts; i++) {
|
||||||
char key [11];
|
char key [11];
|
||||||
char type [LEN_FONT_NAME + 1];
|
char type [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
char family [LEN_FONT_NAME + 1];
|
char family [LEN_LOGFONT_FAMILY_FILED + 1];
|
||||||
char style [LEN_FONT_NAME + 1];
|
char style [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
char charset [LEN_FONT_NAME + 1];
|
char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
char font_name [LEN_DEVFONT_NAME + 1];
|
char font_name [LEN_DEVFONT_NAME + 1];
|
||||||
int height;
|
int height;
|
||||||
int j = 0, need = 0;
|
int j = 0, need = 0;
|
||||||
@@ -205,28 +205,28 @@ void mg_TermSysFont (void)
|
|||||||
const char* GUIAPI GetSysCharset (BOOL wchar)
|
const char* GUIAPI GetSysCharset (BOOL wchar)
|
||||||
{
|
{
|
||||||
if (wchar) {
|
if (wchar) {
|
||||||
if (g_SysLogFont[1]->mbc_devfont)
|
if (g_SysLogFont[1]->devfonts[1])
|
||||||
return MBC_DEVFONT_INFO_P (g_SysLogFont[1])->charset_ops->name;
|
return g_SysLogFont[1]->devfonts[1]->charset_ops->name;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
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)
|
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);
|
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[0], sbc_devfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUIAPI GetSysCCharWidth (void)
|
int GUIAPI GetSysCCharWidth (void)
|
||||||
{
|
{
|
||||||
DEVFONT* mbc_devfont = g_SysLogFont[1]->mbc_devfont;
|
DEVFONT* mbc_devfont = g_SysLogFont[1]->devfonts[1];
|
||||||
|
|
||||||
if (mbc_devfont)
|
if (mbc_devfont)
|
||||||
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
|
return mbc_devfont->font_ops->get_ave_width (g_SysLogFont[1], mbc_devfont);
|
||||||
else
|
else
|
||||||
return GetSysCharWidth () * 2;
|
return GetSysCharWidth () * 2;
|
||||||
}
|
}
|
||||||
@@ -238,14 +238,14 @@ int GUIAPI GetSysCharHeight (void)
|
|||||||
|
|
||||||
int GUIAPI GetSysFontMaxWidth (int font_id)
|
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);
|
return sbc_devfont->font_ops->get_max_width (g_SysLogFont[font_id], sbc_devfont);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUIAPI GetSysFontAveWidth (int font_id)
|
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);
|
return sbc_devfont->font_ops->get_ave_width (g_SysLogFont[font_id], sbc_devfont);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ BOOL mg_InitSysFont (void)
|
|||||||
|
|
||||||
for (i = 0; i < nr_fonts; i++) {
|
for (i = 0; i < nr_fonts; i++) {
|
||||||
char key [11];
|
char key [11];
|
||||||
char charset [LEN_FONT_NAME + 1];
|
char charset [LEN_LOGFONT_NAME_FIELD + 1];
|
||||||
char file [MAX_PATH + 1];
|
char file [MAX_PATH + 1];
|
||||||
|
|
||||||
sprintf (key, "name%d", i);
|
sprintf (key, "name%d", i);
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ u:arabic_test_unicode
|
|||||||
hex:arabic_test_hex
|
hex:arabic_test_hex
|
||||||
|
|
||||||
MINIGUI_COMMON = /usr/local/include/minigui
|
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)
|
arabic_test:arabic_test.c $(MINIGUI_COMMON)
|
||||||
gcc arabic_test.c -Wall -g -o arabic_test $(LIBS)
|
gcc arabic_test.c -Wall -g -o arabic_test $(LIBS)
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ void read_total_file( void )
|
|||||||
fclose (fp);
|
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;
|
HDC hdc;
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
|||||||
@@ -101,10 +101,10 @@ static int test_correctness ()
|
|||||||
if (index < 0) /* not a letter.*/
|
if (index < 0) /* not a letter.*/
|
||||||
continue;
|
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);
|
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);
|
fprintf (stderr, "Shape error: %x\n", *c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ helloworld:helloworld.c
|
|||||||
gcc helloworld.c -Wall -g -o helloworld -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
|
gcc helloworld.c -Wall -g -o helloworld -lminigui_ths -lm -ljpeg -lz -lfreetype -lpng -lpthread
|
||||||
|
|
||||||
hebrew_test:hebrew_test.c
|
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
|
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
|
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
|
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
|
gcc hebrew_test.c -DARABIC_UNICODE -DARABIC_DEBUG -g -o hebrew_test_u -lminigui_ths -lm -lfreetype -ljpeg -lz -lpng -lpthread
|
||||||
|
|||||||
@@ -59,23 +59,23 @@ char filename[256];
|
|||||||
char fontname[50];
|
char fontname[50];
|
||||||
|
|
||||||
BOOL textout = TRUE;
|
BOOL textout = TRUE;
|
||||||
RECT arabic_rc = {0, 0, 640, 480};
|
RECT hebrew_rc = {0, 0, 640, 480};
|
||||||
int line_num = 0;
|
int line_num = 0;
|
||||||
|
|
||||||
static char msg_text [256] = "Show text with TextOut.";
|
static char msg_text [256] = "Show text with TextOut.";
|
||||||
|
|
||||||
static FILE *fp = NULL;
|
static FILE *fp = NULL;
|
||||||
static PLOGFONT logfont_iso8859_8;
|
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()
|
static int reset_fp_pos()
|
||||||
{
|
{
|
||||||
arabic_rc.left = 0;
|
hebrew_rc.left = 0;
|
||||||
arabic_rc.top = 0;
|
hebrew_rc.top = 0;
|
||||||
arabic_rc.right = g_rcScr.right - 24;
|
hebrew_rc.right = g_rcScr.right - 24;
|
||||||
arabic_rc.bottom = g_rcScr.bottom;
|
hebrew_rc.bottom = g_rcScr.bottom;
|
||||||
if(!fp){
|
if(!fp){
|
||||||
DBGLOG2("============================= arabic_test %s===============================\n", filename);
|
DBGLOG2("============================= hebrew_test %s===============================\n", filename);
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
DBGLOG2("cannot open %s\n", filename);
|
DBGLOG2("cannot open %s\n", filename);
|
||||||
@@ -140,7 +140,7 @@ void read_total_file( void )
|
|||||||
fclose (fp);
|
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;
|
HDC hdc;
|
||||||
switch (message) {
|
switch (message) {
|
||||||
@@ -196,13 +196,13 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
if(textout == TRUE) {
|
if(textout == TRUE) {
|
||||||
if(GetTextAlign(hdc) == TA_RIGHT)
|
if(GetTextAlign(hdc) == TA_RIGHT)
|
||||||
TextOut(hdc, arabic_rc.right, i*line_height, pline);
|
TextOut(hdc, hebrew_rc.right, i*line_height, pline);
|
||||||
else
|
else
|
||||||
TextOut(hdc, arabic_rc.left, i*line_height, pline);
|
TextOut(hdc, hebrew_rc.left, i*line_height, pline);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
int height = DrawText(hdc, pline, -1, &arabic_rc, DT_RIGHT);
|
int height = DrawText(hdc, pline, -1, &hebrew_rc, DT_RIGHT);
|
||||||
arabic_rc.top += height;
|
hebrew_rc.top += height;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ static int HelloWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
|
|||||||
/*
|
/*
|
||||||
else{
|
else{
|
||||||
read_total_file();
|
read_total_file();
|
||||||
DrawText(hdc, filebuf, -1, &arabic_rc, DT_RIGHT);
|
DrawText(hdc, filebuf, -1, &hebrew_rc, DT_RIGHT);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
Executable → Regular
+39
-39
@@ -50,8 +50,8 @@
|
|||||||
int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
|
int GUIAPI GetTextMCharInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||||
int* pos_chars)
|
int* pos_chars)
|
||||||
{
|
{
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int left_bytes = len;
|
int left_bytes = len;
|
||||||
int len_cur_char;
|
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 GUIAPI GetTextWordInfo (PLOGFONT log_font, const char* mstr, int len,
|
||||||
int* pos_words, WORDINFO* info_words)
|
int* pos_words, WORDINFO* info_words)
|
||||||
{
|
{
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
WORDINFO word_info;
|
WORDINFO word_info;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int left_bytes = len;
|
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)
|
int GUIAPI GetFirstMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||||
{
|
{
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
int len_cur_char = 0;
|
int len_cur_char = 0;
|
||||||
|
|
||||||
if (mbc_devfont) {
|
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)
|
int GUIAPI GetLastMCharLen (PLOGFONT log_font, const char* mstr, int len)
|
||||||
{
|
{
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
int left_bytes = len;
|
int left_bytes = len;
|
||||||
int len_cur_char;
|
int len_cur_char;
|
||||||
int lastlen = 0;
|
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,
|
int GUIAPI GetFirstWord (PLOGFONT log_font, const char* mstr, int len,
|
||||||
WORDINFO* word_info)
|
WORDINFO* word_info)
|
||||||
{
|
{
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
|
|
||||||
if (mbc_devfont) {
|
if (mbc_devfont) {
|
||||||
int mbc_pos;
|
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,
|
int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
||||||
const unsigned char* mchar, int n)
|
const unsigned char* mchar, int n)
|
||||||
{
|
{
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* devfont;
|
DEVFONT* devfont;
|
||||||
int len_cur_char = 0;
|
int len_cur_char = 0;
|
||||||
Glyph32 glyph_value;
|
Glyph32 glyph_value;
|
||||||
UChar32 uc32;
|
Uchar32 uc32;
|
||||||
|
|
||||||
if (mbc_devfont) {
|
if (mbc_devfont) {
|
||||||
len_cur_char = mbc_devfont->charset_ops->len_first_char (mchar, n);
|
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;
|
return 0;
|
||||||
else {
|
else {
|
||||||
if (dest) {
|
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)
|
if(devfont->charset_ops->conv_to_uc32)
|
||||||
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
||||||
else
|
else
|
||||||
uc32 = glyph_value;
|
uc32 = glyph_value;
|
||||||
|
|
||||||
if (wc32) {
|
if (wc32) {
|
||||||
UChar32* uchar32 = (UChar32*)dest;
|
Uchar32* uchar32 = (Uchar32*)dest;
|
||||||
*uchar32 = uc32;
|
*uchar32 = uc32;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UChar16* uchar16 = (UChar16*)dest;
|
Uchar16* uchar16 = (Uchar16*)dest;
|
||||||
if (uc32 > 0xFFFF)
|
if (uc32 > 0xFFFF)
|
||||||
*uchar16 = 0xFEFF;
|
*uchar16 = 0xFEFF;
|
||||||
else
|
else
|
||||||
*uchar16 = (UChar16)uc32;
|
*uchar16 = (Uchar16)uc32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return len_cur_char;
|
return len_cur_char;
|
||||||
@@ -280,10 +280,10 @@ int GUIAPI MB2WCEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
return -1;
|
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* mbc_devfont = log_font->devfonts[1];
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
unsigned char mchar [16];
|
unsigned char mchar [16];
|
||||||
int len_cur_char = 0;
|
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,
|
const unsigned char* mstr, int mstr_len, int n,
|
||||||
int* conved_mstr_len)
|
int* conved_mstr_len)
|
||||||
{
|
{
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
DEVFONT* devfont;
|
DEVFONT* devfont;
|
||||||
int left, count = 0;
|
int left, count = 0;
|
||||||
UChar32* uchar32;
|
Uchar32* uchar32;
|
||||||
UChar16* uchar16;
|
Uchar16* uchar16;
|
||||||
Glyph32 glyph_value;
|
Glyph32 glyph_value;
|
||||||
UChar32 uc32;
|
Uchar32 uc32;
|
||||||
|
|
||||||
if (conved_mstr_len)
|
if (conved_mstr_len)
|
||||||
*conved_mstr_len = 0;
|
*conved_mstr_len = 0;
|
||||||
@@ -328,10 +328,10 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
|
|
||||||
if (wc32) {
|
if (wc32) {
|
||||||
uchar16 = NULL;
|
uchar16 = NULL;
|
||||||
uchar32 = (UChar32*)dest;
|
uchar32 = (Uchar32*)dest;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uchar16 = (UChar16*)dest;
|
uchar16 = (Uchar16*)dest;
|
||||||
uchar32 = NULL;
|
uchar32 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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)
|
if (devfont->charset_ops->conv_to_uc32)
|
||||||
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
uc32 = devfont->charset_ops->conv_to_uc32 (glyph_value);
|
||||||
else
|
else
|
||||||
@@ -384,7 +384,7 @@ int GUIAPI MBS2WCSEx (PLOGFONT log_font, void* dest, BOOL wc32,
|
|||||||
if (uc32 > 0xFFFF)
|
if (uc32 > 0xFFFF)
|
||||||
uchar16 [count] = 0xFEFF;
|
uchar16 [count] = 0xFEFF;
|
||||||
else
|
else
|
||||||
uchar16 [count] = (UChar16)uc32;
|
uchar16 [count] = (Uchar16)uc32;
|
||||||
}
|
}
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
@@ -406,13 +406,13 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
|
|||||||
const void *wcs, int wcs_len, BOOL wc32, int n,
|
const void *wcs, int wcs_len, BOOL wc32, int n,
|
||||||
int* conved_wcs_len)
|
int* conved_wcs_len)
|
||||||
{
|
{
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
DEVFONT* sbc_devfont = log_font->sbc_devfont;
|
DEVFONT* sbc_devfont = log_font->devfonts[0];
|
||||||
int wc_count = 0, count = 0;
|
int wc_count = 0, count = 0;
|
||||||
unsigned char mchar [16] = {0};
|
unsigned char mchar [16] = {0};
|
||||||
const UChar32* uchar32;
|
const Uchar32* uchar32;
|
||||||
const UChar16* uchar16;
|
const Uchar16* uchar16;
|
||||||
UChar32 uc32;
|
Uchar32 uc32;
|
||||||
|
|
||||||
if (conved_wcs_len)
|
if (conved_wcs_len)
|
||||||
*conved_wcs_len = 0;
|
*conved_wcs_len = 0;
|
||||||
@@ -422,10 +422,10 @@ int GUIAPI WCS2MBSEx (PLOGFONT log_font, unsigned char* dest,
|
|||||||
|
|
||||||
if (wc32) {
|
if (wc32) {
|
||||||
uchar16 = NULL;
|
uchar16 = NULL;
|
||||||
uchar32 = (UChar32*)wcs;
|
uchar32 = (Uchar32*)wcs;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uchar16 = (UChar16*)wcs;
|
uchar16 = (Uchar16*)wcs;
|
||||||
uchar32 = NULL;
|
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)
|
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")) {
|
if (mbc_devfont && strstr (mbc_devfont->charset_ops->name, "UTF-16")) {
|
||||||
size_t len = 0;
|
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;
|
size_t i;
|
||||||
unsigned char c1, c2;
|
unsigned char c1, c2;
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
|
|
||||||
if (mbc_devfont) {
|
if (mbc_devfont) {
|
||||||
*chlen = 2;
|
*chlen = 2;
|
||||||
@@ -566,7 +566,7 @@ int __mg_substrlen (PLOGFONT log_font, const char* text, int len,
|
|||||||
|
|
||||||
len = substr - text;
|
len = substr - text;
|
||||||
if (*nr_delim == 2) {
|
if (*nr_delim == 2) {
|
||||||
DEVFONT* mbc_devfont = log_font->mbc_devfont;
|
DEVFONT* mbc_devfont = log_font->devfonts[1];
|
||||||
unsigned char c1, c2;
|
unsigned char c1, c2;
|
||||||
|
|
||||||
if (strstr (mbc_devfont->charset_ops->name, "UTF-16LE")) {
|
if (strstr (mbc_devfont->charset_ops->name, "UTF-16LE")) {
|
||||||
|
|||||||
+6
-3
@@ -79,7 +79,7 @@ static encstruct default_enc;
|
|||||||
|
|
||||||
#define CHARSPACEUNIT2PIXEL(x) (x/1000)
|
#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 j;
|
||||||
int font_id;
|
int font_id;
|
||||||
@@ -109,7 +109,7 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unload_font_data (void* data)
|
static void unload_font_data (DEVFONT* devfont, void* data)
|
||||||
{
|
{
|
||||||
free (data);
|
free (data);
|
||||||
}
|
}
|
||||||
@@ -200,8 +200,11 @@ static int get_font_height (LOGFONT* logfont, DEVFONT* devfont)
|
|||||||
return type1_inst_info->font_height;
|
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;
|
return expect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
typedef struct _bidichar_type_map
|
typedef struct _bidichar_type_map
|
||||||
{
|
{
|
||||||
Uint32 type; // Type of Unicode characters
|
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
|
Uint8 count; // Total number of Unicode characters of same type starting from glyphn
|
||||||
} BIDICHAR_TYPE_MAP;
|
} BIDICHAR_TYPE_MAP;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user