Jump to content

help with a cufon function...


Imaulle

Recommended Posts

Can someone help me figure out what this does exactly and is it possible to do the same thing without using mb_convert_encoding? I need to be able to do this function without that lib

 

public static function getCodePoint($char)
{
$cp = unpack('N', mb_convert_encoding($char, 'UCS-4BE', 'UTF-8'));
return $cp[1];
}

 

This is from the Cufon generator code that converts ttf to js... Thanks!

Link to comment
https://forums.phpfreaks.com/topic/260783-help-with-a-cufon-function/
Share on other sites

upon further investigating I've found out that it's a unicode-friendly version of ord().

- mb_convert_encoding($char, 'UCS-4BE', 'UTF-8') converts a UTF-8 character to UCS-4BE.

- UCS-4BE is 32-bit unicode big endian.

- unpack unpacks binary data into an associative array.

- N specifies unsigned long 32-bit big endian as the format.

- $cp[1] returns the second index of the associative array.

 

 

However I'm still unable to figure out how to do this without using mb_convert_encoding.... Anyone got any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.