Skip to content

Commit

Permalink
Libuninameslist version 20200413
Browse files Browse the repository at this point in the history
Has NamesList.txt 13.0, ListeDesNoms 13.0, and uninameslist.py ver0.2

Updated French libuninameslist-fr from 10.0 to 13.0 and added several
functions in libuninameslist that can be used for displaying language
translations from libuninameslist-fr (or other library if available).

Updated documentation, including do the two-steps for python wrapper.
  • Loading branch information
JoesCat committed Apr 13, 2020
1 parent 2c2aa1a commit 8cfcc7f
Show file tree
Hide file tree
Showing 13 changed files with 371 additions and 146 deletions.
18 changes: 18 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
- 2020-Apr-13
* Version 1.7, Unicode 13.0, French version 1.3 is at Unicode 13.0,
and including python library wrapper 'uninameslist', version 0.2.
The French version was updated from version 10.0 to 13.0 shortly
after Unicode's release - this is a big effort and congratulation
to the French team! This version updates the main library to also
include access to libuninameslist-fr. To include this access, you
need to use './configure --enable-frenchlib'
This is the first step in adding other languages if anyone wants
to add more languages.
The default functions remain as English to retain common grounds
which is necessary for scripting, and/or file-sharing purposes.

- 2020-Mar-13
* Version 1.6, Unicode 13.0, French version 1.2 is at Unicode 10.0.
Unicode has changed cadence to release earlier in the year. This
contains Official 13.0 NamesList.txt codes released on 2020mar05.

- 2019-Jul-01
* Version 1.5, Unicode 12.1, French version 1.2 is at Unicode 10.0.
Contains Official 12.1 codes.
Expand Down
3 changes: 1 addition & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ NamesList.txt:
$(WGET) "https://www.unicode.org/Public/13.0.0/ucd/NamesList.txt" -O NamesList.txt

ListeDesNoms.txt:
# $(WGET) "http://hapax.qc.ca/ListeNoms-13.0.0.beta_2-cp1252.txt" -O ListeDesNoms.txt
$(WGET) "http://hapax.qc.ca/ListeNoms-10.0.0.txt" -O ListeDesNoms.txt
$(WGET) "http://hapax.qc.ca/ListeNoms-13.0.0.txt" -O ListeDesNoms.txt

# test: run all tests in cwd and subdirs
test: $(TEST_PROGS)
Expand Down
62 changes: 46 additions & 16 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ These functions are available in libuninameslist-20180408 and higher
13) int uniNamesList_names2lnU(unsigned long uni);
14) const char *uniNamesList_names2anC(int count);
15) const char *uniNamesList_names2anU(unsigned long uni);
These functions are available in libuninameslist-20200328 and higher
These functions are available in libuninameslist-20200413 and higher
16) const char *uniNamesList_Languages(unsigned int lang);
17) const char *uniNamesList_NamesListVersionAlt(unsigned int lang);
18) const char *uniNamesList_nameAlt(unsigned long uni, unsigned int lang);
19) const char *uniNamesList_annotAlt(unsigned long uni, unsigned int lang);
20) int uniNamesList_nameBoth(unsigned long uni, unsigned int lang, const char **str0, const char **strl);
21) int uniNamesList_annotBoth(unsigned long uni, unsigned int lang, const char **str0, const char **str1);
22) int uniNamesList_blockCountAlt(unsigned int lang);
23) long uniNamesList_blockStartAlt(int uniBlock, unsigned int lang);
24) long uniNamesList_blockEndAlt(int uniBlock, unsigned int lang);
25) const char *uniNamesList_blockNameAlt(int uniBlock, unsigned int lang);
26) int uniNamesList_blockNumberBoth(unsigned long uni, unsigned int lang, int *bn0, int *bn1);

For a better description of each function, check "uninameslist.h", and see
an example of how to use these functions in FontForge ~ 20140101 or later.
Expand All @@ -54,23 +59,36 @@ Building and Installing LibUniNamesList
Read INSTALL for details on building LibUniNamesList using this package.
This package contains 2 libraries, but only 1 is built by default:
1) libuninameslist - holds NamesList.txt data from www.unicode.org
2) libuninameslist-fr - currently holds French 10.0 NamesList.txt
2) libuninameslist-fr - currently holds French 13.0 NamesList.txt
If you need the libuninameslist-fr library then you will also need to enable
building it since the current default is not to build it.
building it since the current default is not to build it. This will also be
recognized in functions 16..26 listed above as lang=1 (English=default=0).
NOTE: You should run 'make clean' if you ran "./configure; make" earlier.
./configure --enable-frenchlib
make clean
make
$ ./configure --enable-frenchlib
$ make clean
$ make
$ su
# make install (or use 'make install-strip' for smaller libraries).
# exit
$

Alternatively, if you do not have autoconf or automake available with your
computer, you can fetch the configure-ready libuninameslist-dist version.

Added Python Wrapper
********************

A python wrapper is provided for users interested in libuninameslist access
using python. The easiest and simplest method for users to add it is to run:
Added 'uninameslist.py' Python Wrapper
**************************************

$ cd py
A python wrapper is provided for users interested in libuninameslist access
using python. The easiest and simplest method for users to add it is to run
the install in two steps, first build and install libuninameslist, then use
python to install the wrapper:
$ ./configure (may need --/prefix=/usr - use --help to see options)
$ make clean
$ make
$ su
# make install
# cd py
# python setup.py install
# exit
$
Expand All @@ -80,13 +98,24 @@ To do this, pass --enable-pylib. Optionally, also set the `PYTHON` environment
variable to configure which python to use. The configured python must have pip,
setuptools and the wheel packages installed.

$ PYTHON=python2 ./configure --enable-pylib
$ PYTHON=python2 ./configure --enable-pylib (may need --/prefix=/usr)
$ make
$ su
# make install
# pip install py/dist/*.whl
# exit
$

Normally, a user default library install is made into '/usr/local', but for
some operating systems, you may need you to add '--prefix=/usr' if you will
be adding python access to uninameslist.py

This two-step install is necessary to avoid using AM_PATH_PYTHON() as part
of './configure' which interferes with installs that cannot include python.

Distro maintainers may also want to look at Adelie which has a great install:
https://code.foxkit.us/adelie/packages/blob/master/user/libuninameslist/APKBUILD


Build Process
*************
Expand All @@ -102,7 +131,7 @@ The default build process can be summarized quickly like this:
$ ./configure
$ make
$ su
# make install
# make install-strip
# exit
$

Expand Down Expand Up @@ -184,8 +213,9 @@ If you are interested in updating an existing file, there are some references
pointing to where latest NamesList style files were found, see in Makefile.am
or other nameslist*.c or uninameslist*.h for possible information if not seen
on readme files. Ask originating Authors if they want/need help if looking at
updating existing files.
If you are aware of translations in another format, they could be considered.
updating existing file (this is a large file, but can be done progressively).
If you are aware of translations in another format, they could be considered,
and functions 16 to 26 are available for displaying alternate languages.


Old Bugs Out, New Bugs In
Expand All @@ -199,4 +229,4 @@ Please report any bugs, patches and/or improvements to:
[email protected]

This file was last updated:
2020-Mar-29, by Joe Da Silva
2020-Apr-13, by Joe Da Silva
114 changes: 76 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ libuninameslist – A Library of Unicode names and annotation data
Description
-----------

This program is updated for Nameslist.txt ver13.0 and ListeDesNoms.txt ver10.0.
This library is updated for Nameslist.txt ver13.0 and ListeDesNoms.txt ver13.0
and includes python wrapper 'uninameslist.py'

For latest release, see: https://github.com/fontforge/libuninameslist/releases
For users that do not have autoconf or automake available, select the '-dist-'
version, which does not need you to first run autoreconf or automake

http://sourceforge.net/projects/libuninameslist/files/ is not kept up to date.

Expand All @@ -27,7 +30,7 @@ quickly and easily.
ListeDesNoms.txt
Is a seperate file which is translated from Nameslist.txt and was outdated for
a period of time but was recently updated by a group of developers who have
updated it up to version 10. Contributors to that file are listed in that file.
updated it up to version 13. Contributors to that file are listed in that file.

These libraries contain very large (sparse) arrays with one entry for each
unicode code point (U+0000–U+10FFFF). Each entry contains two strings, a name
Expand Down Expand Up @@ -65,32 +68,37 @@ TAB can be expanded with UTF-8 character substitutions as defined below:

With the default configure option chosen, this package will install one library
file, one header file, and one library man file. The library is 'libuninameslist',
and the header is `<uninameslist.h>`. You can access these fifteen functions:
and the header is `<uninameslist.h>`. You can access these twenty-six functions:
```c
const char *uniNamesList_name(unsigned long uni);
const char *uniNamesList_annot(unsigned long uni);
const char *uniNamesList_NamesListVersion(void);
1) const char *uniNamesList_name(unsigned long uni);
2) const char *uniNamesList_annot(unsigned long uni);
3) const char *uniNamesList_NamesListVersion(void);
These functions are available in libuninameslist-0.4.20140731 and higher
int uniNamesList_blockCount(void);
int uniNamesList_blockNumber(unsigned long uni);
long uniNamesList_blockStart(int uniBlock);
long uniNamesList_blockEnd(int uniBlock);
const char *uniNamesList_blockName(int uniBlock);
4) int uniNamesList_blockCount(void);
5) int uniNamesList_blockNumber(unsigned long uni);
6) long uniNamesList_blockStart(int uniBlock);
7) long uniNamesList_blockEnd(int uniBlock);
8) const char *uniNamesList_blockName(int uniBlock);
These functions are available in libuninameslist-20180408 and higher
int uniNamesList_names2cnt(void);
long uniNamesList_names2val(int count);
int uniNamesList_names2getU(unsigned long uni);
int uniNamesList_names2lnC(int count);
int uniNamesList_names2lnU(unsigned long uni);
const char *uniNamesList_names2anC(int count);
const char *uniNamesList_names2anU(unsigned long uni);
These functions are available in libuninameslist-20200328 and higher
const char *uniNamesList_Languages(unsigned int lang);
const char *uniNamesList_NamesListVersionAlt(unsigned int lang);
const char *uniNamesList_nameAlt(unsigned long uni, unsigned int lang);
const char *uniNamesList_annotAlt(unsigned long uni, unsigned int lang);
int uniNamesList_nameBoth(unsigned long uni, unsigned int lang, const char **str0, const char **strl);
int uniNamesList_annotBoth(unsigned long uni, unsigned int lang, const char **str0, const char **str1);
9) int uniNamesList_names2cnt(void);
10) long uniNamesList_names2val(int count);
11) int uniNamesList_names2getU(unsigned long uni);
12) int uniNamesList_names2lnC(int count);
13) int uniNamesList_names2lnU(unsigned long uni);
14) const char *uniNamesList_names2anC(int count);
15) const char *uniNamesList_names2anU(unsigned long uni);
These functions are available in libuninameslist-20200413 and higher
16) const char *uniNamesList_Languages(unsigned int lang);
17) const char *uniNamesList_NamesListVersionAlt(unsigned int lang);
18) const char *uniNamesList_nameAlt(unsigned long uni, unsigned int lang);
19) const char *uniNamesList_annotAlt(unsigned long uni, unsigned int lang);
20) int uniNamesList_nameBoth(unsigned long uni, unsigned int lang, const char **str0, const char **strl);
21) int uniNamesList_annotBoth(unsigned long uni, unsigned int lang, const char **str0, const char **str1);
22) int uniNamesList_blockCountAlt(unsigned int lang);
23) long uniNamesList_blockStartAlt(int uniBlock, unsigned int lang);
24) long uniNamesList_blockEndAlt(int uniBlock, unsigned int lang);
25) const char *uniNamesList_blockNameAlt(int uniBlock, unsigned int lang);
26) int uniNamesList_blockNumberBoth(unsigned long uni, unsigned int lang, int *bn0, int *bn1);
```
and for backwards compatibility for older programs that still use it, there is:
Expand All @@ -115,21 +123,30 @@ This library maintains the same 'name' and 'annot' structure, but has function
names with FR so that it is possible to open both libraries at the same time.
The header file for the French library is `<uninameslist-fr.h>`

This library will also be linked to the main libuninameslist so that it can
be used through the main library (as lang=1) for functions 16 to 26.

NOTE: If you ran 'make' after running './configure' earlier, you will need to
run 'make clean' to clear-out the earlier libuninameslist library, which is
built without knowledge of the additional library.
```c
make clean
make
$ make clean
$ make
$ sudo make install
```
for users with smaller systems, or want slightly smaller libraries and have
strip available, you can run:
```c
$ sudo make install-strip
```

Installation and Build Instructions
-----------------------------------

Download a tagged release version from https://github.com/fontforge/libuninameslist/releases
```bash
$ wget https://github.com/fontforge/libuninameslist/archive/20200313.tar.gz
$ tar -xzf 20200313.tar.gz
$ wget https://github.com/fontforge/libuninameslist/archive/20200413.tar.gz
$ tar -xzf 20200413.tar.gz
$ cd libuninameslist
```

Expand All @@ -154,6 +171,7 @@ $ ./configure --help
$ ./configure --enable-frenchlib
$ make clean
$ make
$ sudo make install
```

NOTE: Some Distros and Operating Systems may require you to run 'ldconfig' to
Expand All @@ -167,29 +185,48 @@ $ su -
$
```

NOTE: Users who do not have autoconf and automake available will want to
download the '-dist-' version found in the releases directory.

Added Python Wrapper
--------------------

A Python wrapper is provided. To install, run:
A 'uninameslist.py' Python wrapper is provided for users that want quick
NamesList.txt access using python. To do this, you need to first build and
install the library, and then next, install the python wrapper.
```bash
cd py
# May require sudo if you're not using a virtualenv
python setup.py install
$ ./configure (may need --/prefix=/usr - use --help to see options)
$ make clean
$ make
$ su
# make install
# cd py
# (May require sudo or su if you're not using a virtualenv)
# python setup.py install
# exit
$
```

The build system can optionally also build installable wheels of the package.
To do this, pass `--enable-pylib`. Optionally, also set the `PYTHON` environment
variable to configure which python to use. The configured python must have `pip`,
`setuptools` and the `wheel` packages installed.
```bash
autoreconf -fiv
PYTHON=python2 ./configure --enable-pylib
make
pip install py/dist/*.whl
$ autoreconf -fiv
$ PYTHON=python2 ./configure --enable-pylib
$ make
$ su
# make install
# pip install py/dist/*.whl
# exit
$
```

The Python wrapper exposes the following symbols:
Note, some operating systems may need to use './configure --prefix=/usr'

The Python wrapper exposes the following library functions and symbols:

```python
* **version**: documents the version of **libuninameslist**
* **name(_char_)**: returns the Unicode character name
* **name2(_char_)**: returns the Unicode normative alias if defined for correcting a character name, else just the name
Expand All @@ -199,6 +236,7 @@ The Python wrapper exposes the following symbols:
* **blocks()**: a generator for iterating through all defined Unicode blocks
* **valid(_char_)**: returns whether the character is valid (defined in Unicode)
* **uplus(_char_)**: returns the Unicode codepoint for a character in the format U+XXXX for BMP and U+XXXXXX beyond that
```

Blocks can be iterated over to yield all characters encoded in them.

Expand Down
Loading

0 comments on commit 8cfcc7f

Please sign in to comment.