Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code improvements #126

Merged
merged 4 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"

steps:

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install PHP
uses: "shivammathur/setup-php@v2"
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Usage Example
-------------

### Base font information
```

```php
$font = \FontLib\Font::load('fontfile.ttf');
$font->parse(); // for getFontWeight() to work this call must be done first!
echo $font->getFontName() .'<br>';
Expand All @@ -28,14 +29,16 @@ $font->close();
```

### Font Metrics Generation
```

```php
$font = FontLib\Font::load('fontfile.ttf');
$font->parse();
$font->saveAdobeFontMetrics('fontfile.ufm');
```

### Create a font subset
```

```php
$font = FontLib\Font::load('fontfile.ttf');
$font->parse();
$font->setSubset("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ.:,;' (!?)+-*/== 1234567890"); // characters to include
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "library",
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib",
"license": "LGPL-3.0",
"license": "LGPL-2.1-or-later",
"authors": [
{
"name": "Fabien Ménager",
Expand Down
4 changes: 2 additions & 2 deletions src/FontLib/AdobeFontMetrics.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down Expand Up @@ -48,7 +48,7 @@ function write($file, $encoding = null) {

$this->startSection("FontMetrics", 4.1);
$this->addPair("Notice", "Converted by PHP-font-lib");
$this->addPair("Comment", "https://github.com/PhenX/php-font-lib");
$this->addPair("Comment", "https://github.com/dompdf/php-font-lib");

$encoding_scheme = ($encoding ? $encoding : "FontSpecific");
$this->addPair("EncodingScheme", $encoding_scheme);
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/BinaryStream.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/EOT/File.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/EOT/Header.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/EncodingMap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Font.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Glyph/Outline.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @version $Id: Font_Table_glyf.php 46 2012-04-02 20:22:38Z fabien.menager $
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Glyph/OutlineComponent.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @version $Id: Font_Table_glyf.php 46 2012-04-02 20:22:38Z fabien.menager $
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Glyph/OutlineComposite.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @version $Id: Font_Table_glyf.php 46 2012-04-02 20:22:38Z fabien.menager $
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Glyph/OutlineSimple.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @version $Id: Font_Table_glyf.php 46 2012-04-02 20:22:38Z fabien.menager $
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Header.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/OpenType/File.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/OpenType/TableDirectoryEntry.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/DirectoryEntry.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Table.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/cmap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/glyf.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/head.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/hhea.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/hmtx.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/kern.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/loca.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/maxp.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/name.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/nameRecord.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/os2.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/Table/Type/post.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/TrueType/Collection.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/TrueType/File.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/TrueType/Header.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/TrueType/TableDirectoryEntry.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/WOFF/File.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/WOFF/Header.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down
2 changes: 1 addition & 1 deletion src/FontLib/WOFF/TableDirectoryEntry.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package php-font-lib
* @link https://github.com/PhenX/php-font-lib
* @link https://github.com/dompdf/php-font-lib
* @author Fabien Ménager <[email protected]>
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
Expand Down