src/OtlDump.php
function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs)
	{
		$glyphPos = $this->glyphPos[$originalGlyphIdx];
		$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
		if (!$glyphLen) {
			return;
		}
		$this->seek($start + $glyphPos);
		$numberOfContours = $this->read_short();
		if ($numberOfContours < 0) {
			$this->skip(8);
			$flags = GlyphOperator::MORE;
			while ($flags & GlyphOperator::MORE) {
				$flags = $this->read_ushort();
			}
			$glyphIdx = $this->read_ushort();
			if (!isset($glyphSet[$glyphIdx])) {
				$glyphSet[$glyphIdx] = count($subsetglyphs); // old glyphID to new glyphID
				$subsetglyphs[$glyphIdx] = true;
			}
			$savepos = ftell($this->fh);
			$this->getGlyphs($glyphIdx, $start, $glyphSet, $subsetglyphs);
			$this->seek($savepos);
			if ($flags & GlyphOperator::WORDS) {
				$this->skip(4);
			} else {
				$this->skip(2);
			}
			if ($flags & GlyphOperator::SCALE) {
				$this->skip(2);
			} else {
				if ($flags & GlyphOperator::XYSCALE) {
					$this->skip(4);
				} else {
					if ($flags & GlyphOperator::TWOBYTWO) {
						$this->skip(8);
					}
				}
			}
		}
	}
function getGlyphs($originalGlyphIdx, &$start, &$glyphSet, &$subsetglyphs)
	{
		$glyphPos = $this->glyphPos[$originalGlyphIdx];
		$glyphLen = $this->glyphPos[$originalGlyphIdx + 1] - $glyphPos;
		if (!$glyphLen) {
			return;
		}
		$this->seek($start + $glyphPos);
		$numberOfContours = $this->read_short();
		if ($numberOfContours < 0) {
			$this->skip(8);
			$flags = GlyphOperator::MORE;
			while ($flags & GlyphOperator::MORE) {
				$flags = $this->read_ushort();
			}
			$glyphIdx = $this->read_ushort();
			if (!isset($glyphSet[$glyphIdx])) {
				$glyphSet[$glyphIdx] = count($subsetglyphs); // old glyphID to new glyphID
				$subsetglyphs[$glyphIdx] = true;
			}
			$savepos = ftell($this->fh);
			$this->getGlyphs($glyphIdx, $start, $glyphSet, $subsetglyphs);
			$this->seek($savepos);
			if ($flags & GlyphOperator::WORDS) {
				$this->skip(4);
			} else {
				$this->skip(2);
			}
			if ($flags & GlyphOperator::SCALE) {
				$this->skip(2);
			} else {
				if ($flags & GlyphOperator::XYSCALE) {
					$this->skip(4);
				} else {
					if ($flags & GlyphOperator::TWOBYTWO) {
						$this->skip(8);
					}
				}
			}
		}
	}
function getGlyphs ( $ originalGlyphIdx , & $ start , & $ glyphSet , & $ subsetglyphs ) { $ glyphPos = $ this -> glyphPos [ $ originalGlyphIdx ] ; $ glyphLen = $ this -> glyphPos [ $ originalGlyphIdx + 1 ] - $ glyphPos ; if ( ! $ glyphLen ) { return ; } $ this -> seek ( $ start + $ glyphPos ) ; $ numberOfContours = $ this -> read_short ( ) ; if ( $ numberOfContours < 0 ) { $ this -> skip ( 8 ) ; $ flags = GlyphOperator :: MORE ; while ( $ flags & GlyphOperator :: MORE ) { $ flags = $ this -> read_ushort ( ) ; } $ glyphIdx = $ this -> read_ushort ( ) ; if ( ! isset ( $ glyphSet [ $ glyphIdx ] ) ) { $ glyphSet [ $ glyphIdx ] = count ( $ subsetglyphs ) ; // old glyphID to new glyphID $ subsetglyphs [ $ glyphIdx ] = true ; } $ savepos = ftell ( $ this -> fh ) ; $ this -> getGlyphs ( $ glyphIdx , $ start , $ glyphSet , $ subsetglyphs ) ; $ this -> seek ( $ savepos ) ; if ( $ flags & GlyphOperator :: WORDS ) { $ this -> skip ( 4 ) ; } else { $ this -> skip ( 2 ) ; } if ( $ flags & GlyphOperator :: SCALE ) { $ this -> skip ( 2 ) ; } else { if ( $ flags & GlyphOperator :: XYSCALE ) { $ this -> skip ( 4 ) ; } else { if ( $ flags & GlyphOperator :: TWOBYTWO ) { $ this -> skip ( 8 ) ; } } } } }
Recursively get composite glyphs
Recursively get composite glyphs