Skip to content

Commit 3a19c35

Browse files
committed
Change class names to respect the PSR-0 rules
1 parent 378df0a commit 3a19c35

22 files changed

+77
-75
lines changed

src/FontLib/Adobe_Font_Metrics.php renamed to src/FontLib/AdobeFontMetrics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @package php-font-lib
1818
*/
19-
class Adobe_Font_Metrics {
19+
class AdobeFontMetrics {
2020
private $f;
2121

2222
/**
@@ -38,7 +38,7 @@ function write($file, $encoding = null) {
3838
throw new \Exception("Unkown encoding ($encoding)");
3939
}
4040

41-
$map = new Encoding_Map($map_file);
41+
$map = new EncodingMap($map_file);
4242
$map_data = $map->parse();
4343
}
4444

src/FontLib/Binary_Stream.php renamed to src/FontLib/BinaryStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @package php-font-lib
1515
*/
16-
class Binary_Stream {
16+
class BinaryStream {
1717
/**
1818
* @var resource The file pointer
1919
*/

src/FontLib/EOT/File.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ function parse() {
6161
// TODO Read font data ...
6262
}
6363

64-
/**
65-
* Little endian version of the read method
66-
*/
64+
/**
65+
* Little endian version of the read method
66+
*
67+
* @param int $n The number of bytes to read
68+
*
69+
* @return string
70+
*/
6771
public function read($n) {
6872
if ($n < 1) {
6973
return "";

src/FontLib/Encoding_Map.php renamed to src/FontLib/EncodingMap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @package php-font-lib
1515
*/
16-
class Encoding_Map {
16+
class EncodingMap {
1717
private $f;
1818

1919
function __construct($file) {
@@ -24,7 +24,7 @@ function parse() {
2424
$map = array();
2525

2626
while ($line = fgets($this->f)) {
27-
if (preg_match("/^[\!\=]([0-9A-F]{2,})\s+U\+([0-9A-F]{2})([0-9A-F]{2})\s+([^\s]+)/", $line, $matches)) {
27+
if (preg_match('/^[\!\=]([0-9A-F]{2,})\s+U\+([0-9A-F]{2})([0-9A-F]{2})\s+([^\s]+)/', $line, $matches)) {
2828
$unicode = (hexdec($matches[2]) << 8) + hexdec($matches[3]);
2929
$map[hexdec($matches[1])] = array($unicode, $matches[4]);
3030
}

src/FontLib/Glyph/Outline.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
use FontLib\Table\Type\glyf;
1212
use FontLib\TrueType\File;
13-
use FontLib\Binary_Stream;
13+
use FontLib\BinaryStream;
1414

1515
/**
1616
* `glyf` font table.
1717
*
1818
* @package php-font-lib
1919
*/
20-
class Outline extends Binary_Stream {
20+
class Outline extends BinaryStream {
2121
/**
2222
* @var \FontLib\Table\Type\glyf
2323
*/
@@ -47,12 +47,12 @@ static function init(glyf $table, $offset, $size) {
4747
$font->seek($offset);
4848

4949
if ($font->readInt16() > -1) {
50-
/** @var Outline_Simple $glyph */
51-
$glyph = new Outline_Simple($table, $offset, $size);
50+
/** @var OutlineSimple $glyph */
51+
$glyph = new OutlineSimple($table, $offset, $size);
5252
}
5353
else {
54-
/** @var Outline_Composite $glyph */
55-
$glyph = new Outline_Composite($table, $offset, $size);
54+
/** @var OutlineComposite $glyph */
55+
$glyph = new OutlineComposite($table, $offset, $size);
5656
}
5757

5858
$glyph->parse();

src/FontLib/Glyph/Outline_Component.php renamed to src/FontLib/Glyph/OutlineComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @package php-font-lib
1515
*/
16-
class Outline_Component {
16+
class OutlineComponent {
1717
public $flags;
1818
public $glyphIndex;
1919
public $a, $b, $c, $d, $e, $f;

src/FontLib/Glyph/Outline_Composite.php renamed to src/FontLib/Glyph/OutlineComposite.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99

1010
namespace FontLib\Glyph;
1111

12-
use FontLib\Table\Type\glyf;
13-
1412
/**
1513
* Composite glyph outline
1614
*
1715
* @package php-font-lib
1816
*/
19-
class Outline_Composite extends Outline {
17+
class OutlineComposite extends Outline {
2018
const ARG_1_AND_2_ARE_WORDS = 0x0001;
2119
const ARGS_ARE_XY_VALUES = 0x0002;
2220
const ROUND_XY_TO_GRID = 0x0004;
@@ -29,7 +27,7 @@ class Outline_Composite extends Outline {
2927
const OVERLAP_COMPOUND = 0x0400;
3028

3129
/**
32-
* @var Outline_Component[]
30+
* @var OutlineComponent[]
3331
*/
3432
public $components = array();
3533

@@ -113,7 +111,7 @@ function parseData() {
113111
//
114112
//}
115113

116-
$component = new Outline_Component();
114+
$component = new OutlineComponent();
117115
$component->flags = $flags;
118116
$component->glyphIndex = $glyphIndex;
119117
$component->a = $a;
@@ -219,7 +217,7 @@ function encode() {
219217
public function getSVGContours() {
220218
$contours = array();
221219

222-
/** @var \FontLib\Table\\FontLib\Table\Type\glyf $glyph_data */
220+
/** @var \FontLib\Table\Type\glyf $glyph_data */
223221
$glyph_data = $this->getFont()->getTableObject("glyf");
224222

225223
/** @var Outline[] $glyphs */

src/FontLib/Glyph/Outline_Simple.php renamed to src/FontLib/Glyph/OutlineSimple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @package php-font-lib
1616
*/
17-
class Outline_Simple extends Outline {
17+
class OutlineSimple extends Outline {
1818
const ON_CURVE = 0x01;
1919
const X_SHORT_VECTOR = 0x02;
2020
const Y_SHORT_VECTOR = 0x04;

src/FontLib/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @package php-font-lib
1616
*/
17-
abstract class Header extends Binary_Stream {
17+
abstract class Header extends BinaryStream {
1818
/**
1919
* @var File
2020
*/

src/FontLib/OpenType/Table_Directory_Entry.php renamed to src/FontLib/OpenType/TableDirectoryEntry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
*
1414
* @package php-font-lib
1515
*/
16-
class Table_Directory_Entry extends \FontLib\TrueType\Table_Directory_Entry {
16+
class TableDirectoryEntry extends \FontLib\TrueType\TableDirectoryEntry {
1717

1818
}

0 commit comments

Comments
 (0)