Get glyphs

@param string  $char Char
@param integer $type Type

@return string
10303
protected function getGlyphs($char, $type)
    {

        $pos = mb_strpos($this->_glyphs, $char);
        
        if ($pos > 49) {
            $pos = ($pos-49)/2 + 49;
        }
        
        $pos = $pos*16 + $type*4;
        
        return substr($this->_hex, $pos, 4);
    }
1148264
public static function getCodeByType($type)
    {
        if (isset(self::$typeList[$type])) {
            return self::$typeList[$type];
        } else {
            return false;
        }
    }
1318802
private function getTypeXml($type)
    {
        if (!isset($this->styles[$type])) {
            return "<{$type}/>";
        }

        return sprintf(StyleXml::BORDER_TYPE_XML,
            $type, $this->styles[$type], $this->colors[$type], $type);
    }
242312
public static function getType($type)
    {
        $type = strtolower($type);

        if (!isset(static::$typeMapping[$type])) {
            return $type;
        }

        return static::$typeMapping[$type];
    }
1206461
protected function getCharacter($type)
    {
        $character = $this->charSet[$type][rand(0, strlen($this->charSet[$type]) - 1)];

        if ($this->unique) {
            $this->removeFromArray($character);
        }

        return $character;
    }
253224
function getGlyphData($originalGlyphIdx, &$maxdepth, &$depth, &$points, &$contours)
	{
		$depth++;
		$maxdepth = max($maxdepth, $depth);
		if (count($this->glyphdata[$originalGlyphIdx]['compGlyphs'])) {
			foreach ($this->glyphdata[$originalGlyphIdx]['compGlyphs'] as $glyphIdx) {
				$this->getGlyphData($glyphIdx, $maxdepth, $depth, $points, $contours);
			}
		} else {
			if (($this->glyphdata[$originalGlyphIdx]['nContours'] > 0) && $depth > 0) { // simple
				$contours += $this->glyphdata[$originalGlyphIdx]['nContours'];
				$points += $this->glyphdata[$originalGlyphIdx]['nPoints'];
			}
		}
		$depth--;
	}
1148398
private function getFormat(Type $type): string
    {
        return $type->hasParam(0) ? $type->getParam(0) : $this->defaultFormat;
    }
1220019
public static function getLogger($type) {
        if (!isset(self::$Loggers[$type])) {
            self::$Loggers[$type] = self::createLogger($type);
        }
        return self::$Loggers[$type];
    }
615225
public function getValueByType($type)
    {
        $type = strtoupper($type);

        switch ($type) {
            case static::EAN:
                return $this->asEan();

            case static::ISBN10:
                return $this->asIsbn10();

            case static::ISBN13:
                return $this->asIsbn13();

            case static::UPC:
                return $this->asUpc();

            default:
                throw new Exception("Type {$type} not supported");
        }
    }
961952
private static function getExtendedVersion($char) {
        $o = ord($char);
        if ($o === 0) {
            return '%U';
        } elseif ($o >= 1 && $o <= 26) {
            return '$' . chr($o + 64);
        } elseif (($o >= 33 && $o <= 44) || $o === 47 || $o === 48) {
            return '/' . chr($o + 32);
        } elseif ($o >= 97 && $o <= 122) {
            return '+' . chr($o - 32);
        } elseif ($o >= 27 && $o <= 31) {
            return '%' . chr($o + 38);
        } elseif ($o >= 59 && $o <= 63) {
            return '%' . chr($o + 11);
        } elseif ($o >= 91 && $o <= 95) {
            return '%' . chr($o - 16);
        } elseif ($o >= 123 && $o <= 127) {
            return '%' . chr($o - 43);
        } elseif ($o === 64) {
            return '%V';
        } elseif ($o === 96) {
            return '%W';
        } elseif ($o > 127) {
            return false;
        } else {
            return $char;
        }
    }
622139
public static function randomChar( $char )
	{
		if ( strlen( $char ) == 0 )
			return '';

		$char = ord( $char );

		if ( $char > 64 && $char < 91 ) // Uppercase
			return static::randomCharRange( 65, 90 );

		if ( $char > 96 && $char < 123 ) // Lowercase
			return static::randomCharRange( 97, 122 );

		if ( $char > 47 && $char < 58 ) // Numeric
			return static::randomCharRange( 48, 57 );

		return static::$randomCharMap[random_int( 0, count( static::$randomCharMap ) )];
	}
691587
private static function getCodePoint($char)
    {
        if ($char !== htmlspecialchars_decode(htmlspecialchars($char, ENT_COMPAT, 'UTF-8'))) {
            return 0xFFFD;
        }

        $x = ord($char[0]);

        if ($x < 0x80) {
            return $x;
        } elseif ($x < 0xE0) {
            $y = ord($char[1]);

            return (($x & 0x1F) << 6) | ($y & 0x3F);
        } elseif ($x < 0xF0) {
            $y = ord($char[1]);
            $z = ord($char[2]);

            return (($x & 0xF) << 12) | (($y & 0x3F) << 6) | ($z & 0x3F);
        }

        $y = ord($char[1]);
        $z = ord($char[2]);
        $w = ord($char[3]);

        return (($x & 0x7) << 18) | (($y & 0x3F) << 12) | (($z & 0x3F) << 6) | ($w & 0x3F);
    }
372890
def getCharStringForGlyph(self, glyph, private, globalSubrs):
        
        width = glyph.width
        defaultWidth = private.defaultWidthX
        nominalWidth = private.nominalWidthX
        if width == defaultWidth:
            # if width equals the default it can be omitted from charstring
            width = None
        else:
            # subtract the nominal width
            width -= nominalWidth
        if width is not None:
            width = otRound(width)
        pen = T2CharStringPen(width, self.allGlyphs,
                              roundTolerance=self.roundTolerance)
        glyph.draw(pen)
        charString = pen.getCharString(
            private, globalSubrs, optimize=self.optimizeCFF
        )
        return charString
893841
public static function isLetterOrDigit($char)
    {
        $pattern = self::getLetterOrDigitPattern();

        return is_scalar($char) && (bool)preg_match($pattern, $char);
    }
925209
public function randText($type)
    {
        $string = '';
        switch ($type) {
            case 'en':
                $str = 'ABCDEFGHJKLMNPQRSTUVWXY3456789';
                for ($i = 0; $i < $this->textNum; ++$i) {
                    $string = $string.','.$str[mt_rand(0, 29)];
                }
                break;
            case 'cn':
                for ($i = 0; $i < $this->textNum; ++$i) {
                    $string = $string.','.chr(rand(0xB0, 0xCC)).chr(rand(0xA1, 0xBB));
                }
                $string = iconv('GB2312', 'UTF-8', $string); //转换编码到utf8
                break;
        }

        return substr($string, 1);
    }
263583
public static function nameShape($type)
    {
        if (isset(self::$shape_names[$type])) {
            return self::$shape_names[$type];
        }

        return sprintf('Shape %d', $type);
    }
930420
public static function charNotInAlphabet(string $char) : self
    {
        $ord = \ord($char);

        if ($ord < 32 || $ord > 126) {
            $char = \strtoupper(\dechex($ord));

            if ($ord < 10) {
                $char = '0' . $char;
            }
        } else {
            $char = '"' . $char . '"';
        }

        return new self(sprintf('Char %s is not a valid character in the given alphabet.', $char));
    }