Font Awesome Manager

Font Awesome Manager 1.2.1

No permission to download

Kirby

Well-known member
Kirby submitted a new resource:

Font Awesome Manager - An Addon to easily subset Font Awesome for XenForo

XenForo uses the icoon font Font Awesome Pro 5 which contains a few thousand icons of which XenForo does usually only use a few hundred.
But as all icons are included in the CSS and font files, browsers have to download the full font files and CSS which does cause a significant overhead in most cases.

By subsetting the font to include only those icons that are actually being used, the size of the font files and CSS can often be drastically reduced which...

Read more about this resource...
 

thumped

Well-known member
I'll preface this with the standard disclaimer that I have absolutely no idea what I'm doing, but to get this working on the latest cPanel on centos 7, rather than using the specified instructions:

CentOS 7
yum install python pip
pip install fonttools
php install fonttools[woff]

I had to use:

yum install python-pip
pip install --upgrade pip
pip3 install fonttools
pip3 install fonttools[woff]
 

Kirby

Well-known member
I'll preface this with the standard disclaimer that I have absolutely no idea what I'm doing, but to get this working on the latest cPanel on centos 7, rather than using the specified instructions:
I don't use CentOS so I haven't tested this myself but rather included Informationen that was provided by users.

To me it seems like your command sequence is a bit of a mix between Python 2 (pip) and Python 3 (pip3).

Maybe others who actively use CentOS can shed some light on this?
@Mr. Jinx @eva2000
 

Hoffi

Well-known member
Thank you Kirby!

I use FA Icons a lot i my AddOns. Do I need to perform some integration that this addon can identify them?
 

Kirby

Well-known member
Depends on how you are using icons.

If they are statically referenced
  • In templates using tag xf:fa, CSS class fa-xxx or the codepoint
  • In PHP files, options, phrases, style properties using fa-xxx
they should be detected automatically (if using Build Mode = Automatic).

If this is not the case you would have to add them to the settings manually.

If you are using icons in custom entities / custom entity fields you can add the definitions to the settings and FAM will include those in automatic scans.

For [cv6] NodeIcons this would be
XF:Node:cv6_icon in option Additional Entities

Please note that auto detection currently does only work for icons using the selected Font Awesome weight; it will not work for icons specifying a specific weight (eg. fa fa-whatever always uses the icon in solid, no matter which weight is selected - auto detection would not detect this icon as always being used in solid and thus it might be missing depending on the configured style properties).

Currently there is no programmatic way to register icons that are not detected automatically, though adding such a feature in future versions should be possible.
 
Last edited:

MattW

Well-known member
I don't use CentOS so I haven't tested this myself but rather included Informationen that was provided by users.
Code:
# python --version
Python 2.7.5
# pip --version
pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)

This is all that was required on CentOS7 with the above Python / PIP versions

Code:
pip install fonttools
pip install fonttools[woff]
 

Kirby

Well-known member
Thanks @MattW, so the instructions should be correct (assuming that pip is not lready installed).
I'll adjust that to point out that installing pip is only necessary if it wasn't installed already.
 

Mr. Jinx

Well-known member
I had to use:
yum install python-pip
pip install --upgrade pip
pip3 install fonttools
pip3 install fonttools[woff]

CentOS standard repro's only have Python 2.7. Apparently, your install comes with Python 3.6 which usually comes from another repro, or compiled from source. If you are running Python 3.6, then this would be the preferred way, but it is not standard CentOS.
The commands "yum install python-pip" and "pip install --upgrade pip" are for Python 2.7, so I don't think you would need those in your case?

CentOS 7 with Python 2.7 (default)
This will install Python 2.7 default for Centos 7
Code:
yum install python-pip
pip install fonttools
pip install fonttools[woff]

CentOS 7 with Python 3.6
Check if Python 3.6 and pip3 are installed (pip3 --version)
If Python 3.6 is not installed, you could use Python 2.7 or search for alternative ways to install Python 3.6
If Python 3.6 is installed, you can run the commands below:
Code:
pip3 install fonttools
pip3 install fonttools[woff]
 
Last edited:

Kirby

Well-known member
The commands "yum install python-pip" and "pip install --upgrade pip" are for Python 2.7, so I don't think you would need those in your case?

CentOS 7 with Python 2.7 (default)
This will install Python 2.7 default for Centos 7
Code:
yum install python pip
Now I am a bit confused :)

Is it yum install python-pip (assumably one package named python-pip?) or yum install python pip (packages python and pip)?

It the latter: Would yum install pip be sufficient and pull in python as dependency if that is not installed already?
 

MattW

Well-known member
You might also find issues with certain versions of PIP

Code:
# pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
Fails to install fonttools
Code:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-7RlUTv/fonttools/setup.py", line 476, in <module>
        setup(**setup_params)
      File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib64/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib64/python2.7/distutils/command/install.py", line 575, in run
        self.run_command(cmd_name)
      File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/usr/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 15, in run
        self.byte_compile(outfiles)
      File "/usr/lib64/python2.7/distutils/command/install_lib.py", line 138, in byte_compile
        dry_run=self.dry_run)
      File "/usr/lib64/python2.7/distutils/util.py", line 479, in byte_compile
        compile(file, cfile, dfile)
      File "/tmp/pip-build-7RlUTv/fonttools/setup.py", line 23, in doraise_py_compile
        orig_py_compile(file, cfile=cfile, dfile=dfile, doraise=True)
      File "/usr/lib64/python2.7/py_compile.py", line 117, in compile
        raise py_exc
    py_compile.PyCompileError:   File "/usr/lib/python2.7/site-packages/fontTools/ttLib/tables/otTables.py", line 713
        **self.__dict__,
         ^
    SyntaxError: invalid syntax
   
   
    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-7RlUTv/fonttools/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jngTyt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-7RlUTv/fonttools/

I had to upgrade it to a specific version, as the latest version totally broke PIP
Code:
# pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/b1/44/6e26d5296b83c6aac166e48470d57a00d3ed1f642e89adc4a4e412a01643/pip-21.1.2.tar.gz (1.6MB)
    100% |████████████████████████████████| 1.6MB 708kB/s
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
      Successfully uninstalled pip-8.1.2
  Running setup.py install for pip ... done
Successfully installed pip-21.1.2
[08:04][root@XXX]# pip install fonttools
Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    load_entry_point('pip==21.1.2', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

Working PIP version with Python 2.7
Code:
pip install --upgrade pip==20.3.4
 

duderuud

Well-known member
I had similar problems getting the local tools to work on my Centminmod VPS.

I ended up using the cloud option, that worked without any problems.
 

MattW

Well-known member
I had similar problems getting the local tools to work on my Centminmod VPS.

I ended up using the cloud option, that worked without any problems.
On the Centminmod version, you can go with Python3 as well (I've just swapped over to that, and also installed Python3 on my shared hosting servers to offer this to end users)

Python3 provides fonttools 4
fonttools (4.24.4)

and swapping to that on my shared hosting from the cloud offering has now improved mobile to 99 (was at 95 before)!

1623401032358.png
 
Top