Use Py_TYPE() macro instead of accessing the ob_type member directly.

This macro makes it work for both Python 2 and Python 3.
Conversion of Python string to a UTF-8 encoded C string.

This change makes a function AnyPyString_to_UTF8() which takes any
Python string object and returns a newly-allocated C string which
is UTF-8 encoded.  This works for both Python 2 and Python 3.

For Python 2, it accepts:
* 'unicode' - A unicode string
* 'str' - A "byte" string, which must be UTF-8 encoded if non-ASCII.

For Python 3, it accept:
* 'str' - A unicode string

It does not accept a Python 3 'bytes' string.  If any error occurs
then it returns NULL and raises a Python exception.

Add macro ANYSTRING_CHECK() which checks if the type of a python object
is any string type that would be accepted by the above function.
Use PyVarObject_HEAD_INIT macro to initialize python objects.

This will make it portable to either Python 2 or Python 3.
Don't use PyFile* functions for better Python 3 support.

When loading a python script from a file the code used to open the
files using the Python PyFile_* family of functions.  These do not
work in Python 3 as the entire I/O subsystem has changed significantly
in Py3.

However there was no reason to even use those python functions, as
the C standard I/O functions (e.g., fopen()) work just as well for
the purpose being used.
Changes to python initialization to support both Python 2 and Python 3.

These changes make it possible for the same code to be used with either
Python 2 or Python 3.  The initialization functions are still quite
messy and have lots of duplicated/unnecessary functions, but these
changes make it work.

Also removed the dynamic library loading, as the new build system
apparently makes this unnecessary.
Change loading of initial python files for Python 2/3.

New utility functions for simple linked-lists of strings,
added as new source files strlist.h and strlist.c.

When loading python files at initialization, now look in a
Python-version specific subdirectory first.  For example,
directory ~/.FontForge/python3 or ~/.FontForge/python2 (depending
on the python major version). Only if such a directory does
not exist then look for a common "python" subdirectory;
which is the prior behavior.

When running all the python files in a directory, run them
in lexigraphical (alphabetical) order; previously the order
was random.

Make a new python function, fontforge.scriptPath(), which
returns the list of all the directories in which initialization
python scripts will be found.
For embedded python, pre-import the 'fontforge' and 'psMat' modules.
Simplify and unify Python 2 and Python 3 initialization code.

Remove much duplication of code between Python 2 and Python 3
initialization functions.

When creating the "fontforge" module, pull the names of the
types directly from the PyTypeObject->tp_name field rather than
maintaining a separate (and out-of-sync) array of names.

Make type names (the tp_name field) consistent, and insure they
are of the correct qualified format: <modulename>.<typename>

Hide types that are transient, such as iterators. This means that
these types (classes) are not placed directly in the "fontforge"
module namespace.  These types can't be directly constructed
anyway, so they don't need to polute the already-busy namespace.
Simplify python initalization logic, and unify Python 2 and 3.

This commit makes significant changes to the code dealing
with the initialization of Python, mostly to try to eliminate
the confusing duplication of code dealing with Python 2 versus
Python 3, and to try to simplify much of the initalization
so it is easier to follow.  Some more detailed changes are:

Try to eliminate many #if-#else blocks that switch on the
python major version.

Create a 'module_definition' typedef structure which can hold all the
information defining a module which will work with any python version
(unlike the PyModuleDef structures which were Python 3 only).  This
allows the python initialization to be more general and data-driven
with less case-specific code.

All the different modules are now listed in a single compact place in
the code (the 'all_modules' array), and code that does things to all
the modules now makes use of this list rather than hardcoding the
known modules scattered about the code.

Rename a few arrays with a more consistent naming pattern.

Reorder some functions and arrays into a more natural place in
the code. For instance the list of module types now immediately
follows the list of module methods.

Order the list of type names alphabetically, as the previous
order was mildy random, and the order makes no technical
difference.

For module initialization, separate all the general logic from
any module-specific code, so the general code can be reused
rather than duplicated-and-modified.

For embedded python, initialize the __main__ python namespace
and automatically import the 'fontforge' and 'psMat' modules.
Scripts will no longer have to 'import fontforge' for instance.

Rename FontForge_PythonInit() to FontForge_InitializeEmbeddedPython()
to eliminate confusion with other code which initializes things in
extended mode versus embedded mode.

Make sure the python entry function PYFF_PYTHON_ENTRY_FUNCTION (the
first function that gets called in extending mode when the module is
imported) returns the module object in Python 3.  (Python 2 did not
expect a return value, but Python 3 does)
Add runInitScripts() method to fontforge, and update htdocs appropriately.

This allows python code which imports fontforge as an extension module
to cause the same processing of system and user initialization scripts
to be run as when FontForge runs python in embedded mode.
Factor out PyFF_Main() and minimize the differences between Python 2 and 3.
Remove left-over empty #if-#endif block
Merge branch 'master' of https://github.com/fontforge/fontforge.git into py-python3-fix
Merge pull request #109 from dmeranda/py-python3-fix

Add Python 3.x support for scripting
Added -V and -v to command line (to show version #) - output to stdout

See https://github.com/fontforge/fontforge/issues/241. See commit#2 of 7
Based on top part of Khaled Hosny's commit - 2013-01-04, #8149197
In gutils/gimagereadrgb.c, added comments (help decipher what's happening).
Merge pull request #334 from JoesCat/master

2 really quick patches - partial update asked in issue#241
Make setting up class based kerning a little simpler.

You no longer have to visit the element/font info dialog after using
metrics/kern by classes to setup a class based kerning table.

Also, paging through the lines in a loaded word list no longer crashes
fontforge. This was interesting, if you have a line that is a number
then fontforge will decrement/increment that value on an up/down arrow
press instead of advancing/retreating the current line in your word
list file. Unfortunately, when that happened (by chance) then an event
would also be explicitly triggered which would investigate some stale
data and explode.

Two birds, on commit :/
Merge pull request #335 from monkeyiq/2013feb/issue314

Make setting up class based kerning a little simpler.
Fixed spelling error in fontforge/fontimage.pe

...completes https://github.com/fontforge/fontforge/issues/241