Hello, Since the version 3.8 Squeak correctly displayed Unicode characters if glyphs were part of TTF file I imported. But Squeak Squeak 5.0 cannot do this. For example: 'ąčę' (asciiValues 269, 261, 281) is shown incorrectly. Bug? regards, Vaidotas
Hi Vaidotas,
On Mar 12, 2016, at 2:26 AM, Vaidotas Didžbalis vaidasd@gmail.com wrote:
Hello, Since the version 3.8 Squeak correctly displayed Unicode characters if glyphs were part of TTF file I imported. But Squeak Squeak 5.0 cannot do this. For example: 'ąčę' (asciiValues 269, 261, 281) is shown incorrectly. Bug? regards, Vaidotas
Can you not narrow this down? Can you check whether the glyphs are in the font correctly or not to see whether it's an import or a display issue?
_,,,^..^,,,_ (phone)
Hi Vaidotas,
The following fix should allow you to import a TTF font and display the national characters in Squeak 5.0.
In TTFontReader>>#decodeCmapFmtTable: change i < 256 ifTrue: [seg last > 0 ifTrue: to seg last > 0 ifTrue: and cmap at: i + 1 put: code]]]. to cmap at: i + 1 put: code]]. or revert the method to the version 'nice 12/27/2009 03:10' .
In TTCFontReader>>#processCharMap: change value = 65535 ifFalse: [ "???" to value > 65535 ifFalse: [ "???" .
Now import the font and check the characters display as expected. This is how I would do it:
| tmpStyleName tmpFontFileName |
tmpStyleName := #Arial. tmpFontFileName := '/Library/Fonts/Arial.ttf'.
TTCFont removeStyleName: tmpStyleName. "Remove the existing font if it exists"
TTCFont newTextStyleFromTTFile: tmpFontFileName. "Import the new TTF font"
FontChooserTool open. "Check that font"
Best Regards, Milan
-- View this message in context: http://forum.world.st/TTF-import-broken-in-5-0-tp4884157p4890411.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
Hi Milan, On 17.04.2016, at 14:39, Milan Vavra vavra_milan@yahoo.com wrote:
Hi Vaidotas,
The following fix should allow you to import a TTF font and display the national characters in Squeak 5.0.
In TTFontReader>>#decodeCmapFmtTable: change i < 256 ifTrue: [seg last > 0 ifTrue: to seg last > 0 ifTrue: and cmap at: i + 1 put: code]]]. to cmap at: i + 1 put: code]]. or revert the method to the version 'nice 12/27/2009 03:10' .
In TTCFontReader>>#processCharMap: change value = 65535 ifFalse: [ "???" to value > 65535 ifFalse: [ "???" .
Now import the font and check the characters display as expected.
As I am probably the one who made that not work, can you explain that so I understand what went wrong?
Best -Tobias
This is how I would do it:
| tmpStyleName tmpFontFileName |
tmpStyleName := #Arial. tmpFontFileName := '/Library/Fonts/Arial.ttf'.
TTCFont removeStyleName: tmpStyleName. "Remove the existing font if it exists"
TTCFont newTextStyleFromTTFile: tmpFontFileName. "Import the new TTF font"
FontChooserTool open. "Check that font"
Best Regards, Milan
"Hi Tobias,
Strings in Squeak are either ByteString or WideString based on the Unicode codePoints of their characters. Strings are instances of ByteString if they contain characters with codePoint < 256. And instances of WideString if they contain characters with codePoint >= 256. "
| tmpString1 tmpString2 tmpString3 tmpString4 tmpString5 tmpString6 |
$A codePoint = 65.
tmpString1 := String with: $A. tmpString1 class = ByteString. tmpString1 size = 1.
tmpString2 := String with: (Character codePoint: 269). tmpString2 class = WideString. tmpString2 size = 1.
tmpString3 := tmpString1, tmpString2. tmpString3 class = WideString. tmpString3 size = 2.
tmpString4 := tmpString3 copyFrom: 1 to: 1. tmpString4 class = ByteString. tmpString4 size = 1.
tmpString5 := tmpString2 squeakToUtf8. tmpString5 class = ByteString. tmpString5 size = 2.
tmpString6 := tmpString5 utf8ToSqueak. tmpString6 class = WideString. tmpString6 size = 1.
"The national characters mentioned have Unicode codePoint >= 256.
When importing a Unicode font, the guard i < 256 ifTrue: [] in TTFontReader>>#decodeCmapFmtTable: discards all characters with Unicode codePoint >= 256.
This is undesirable as all those characters mentioned have codePoint >= 256.
The guard value > 65535 ifFalse: [ ] in TTCFontReader>>#processCharMap: discards all characters with Unicode codePoint > 65535.
This is required as glyphs size = 65536 .
Most languages have characters with codePoint <= 65535 so this should not be a problem.
Best Regards, Milan "
-- View this message in context: http://forum.world.st/TTF-import-broken-in-5-0-tp4884157p4890434.html Sent from the Squeak - Dev mailing list archive at Nabble.com.
squeak-dev@lists.squeakfoundation.org