The Inbox: TrueType-kfr.52.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: TrueType-kfr.52.mcz

commits-2
A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-kfr.52.mcz

==================== Summary ====================

Name: TrueType-kfr.52
Author: kfr
Time: 3 January 2019, 10:34:19.705286 pm
UUID: 248937ad-7e63-4c27-b659-6165fdda9ffe
Ancestors: TrueType-pre.51

FontImporterTool would not open because 'Noto Color Emoji' error:  'File does not have a naming table'.  
Delete the font from FontPaths and continue

=============== Diff against TrueType-pre.51 ===============

Item was changed:
  ----- Method: TTFileDescription class>>openFontFile:do: (in category 'instance creation') -----
  openFontFile: fontFileName do: aBlock
  "Open the font with the given font file name"
  | fontFilePath file |
  fontFilePath := FontPaths at: fontFileName
  ifAbsentPut:[self findFontFile: fontFileName].
  fontFilePath ifNil:[^nil].
  file := [FileStream readOnlyFileNamed: fontFilePath] on: Error do:[:ex|
  "We lost the font; someone might have moved it away"
+ FontPaths removeKey: fontFileName ifAbsent:[].
+ ^nil].
+ [^[aBlock value: file binary]  on: Error do:[:ex|
+ "Error reading font. Skip it"
+ FontPaths removeKey: fontFileName ifAbsent:[].
+ ^nil] ] ensure:[file close].
+ !
- fontFilePath removeKey: fontFileName ifAbsent:[].
- ^nil
- ].
- ^[aBlock value: file binary] ensure:[file close].!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: TrueType-kfr.52.mcz

Nicolas Cellier


Le jeu. 3 janv. 2019 à 22:34, <[hidden email]> a écrit :
A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-kfr.52.mcz

==================== Summary ====================

Name: TrueType-kfr.52
Author: kfr
Time: 3 January 2019, 10:34:19.705286 pm
UUID: 248937ad-7e63-4c27-b659-6165fdda9ffe
Ancestors: TrueType-pre.51

FontImporterTool would not open because 'Noto Color Emoji' error:  'File does not have a naming table'. 
Delete the font from FontPaths and continue

=============== Diff against TrueType-pre.51 ===============

Item was changed:
  ----- Method: TTFileDescription class>>openFontFile:do: (in category 'instance creation') -----
  openFontFile: fontFileName do: aBlock
        "Open the font with the given font file name"
        | fontFilePath file |
        fontFilePath := FontPaths at: fontFileName
                ifAbsentPut:[self findFontFile: fontFileName].
        fontFilePath ifNil:[^nil].
        file := [FileStream readOnlyFileNamed: fontFilePath] on: Error do:[:ex|
                "We lost the font; someone might have moved it away"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil].
+       [^[aBlock value: file binary]  on: Error do:[:ex|
+               "Error reading font. Skip it"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil] ] ensure:[file close].
does a ^ works well inside exception handling?
I think that just nil would do the work...
+       !
-               fontFilePath removeKey: fontFileName ifAbsent:[].
-               ^nil
-       ].
-       ^[aBlock value: file binary] ensure:[file close].!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: TrueType-kfr.52.mcz

Karl Ramberg
Hi,
This code is probably wrong.
I posted this fix to inbox because I was unsure how all these nested blocks worked.

It kind of works now, because the FontImporterTool opens.

Best,
Karl



On Thu, Jan 3, 2019 at 10:58 PM Nicolas Cellier <[hidden email]> wrote:


Le jeu. 3 janv. 2019 à 22:34, <[hidden email]> a écrit :
A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-kfr.52.mcz

==================== Summary ====================

Name: TrueType-kfr.52
Author: kfr
Time: 3 January 2019, 10:34:19.705286 pm
UUID: 248937ad-7e63-4c27-b659-6165fdda9ffe
Ancestors: TrueType-pre.51

FontImporterTool would not open because 'Noto Color Emoji' error:  'File does not have a naming table'. 
Delete the font from FontPaths and continue

=============== Diff against TrueType-pre.51 ===============

Item was changed:
  ----- Method: TTFileDescription class>>openFontFile:do: (in category 'instance creation') -----
  openFontFile: fontFileName do: aBlock
        "Open the font with the given font file name"
        | fontFilePath file |
        fontFilePath := FontPaths at: fontFileName
                ifAbsentPut:[self findFontFile: fontFileName].
        fontFilePath ifNil:[^nil].
        file := [FileStream readOnlyFileNamed: fontFilePath] on: Error do:[:ex|
                "We lost the font; someone might have moved it away"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil].
+       [^[aBlock value: file binary]  on: Error do:[:ex|
+               "Error reading font. Skip it"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil] ] ensure:[file close].
does a ^ works well inside exception handling?
I think that just nil would do the work...
+       !
-               fontFilePath removeKey: fontFileName ifAbsent:[].
-               ^nil
-       ].
-       ^[aBlock value: file binary] ensure:[file close].!





Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: TrueType-kfr.52.mcz

Nicolas Cellier


Le ven. 4 janv. 2019 à 06:57, karl ramberg <[hidden email]> a écrit :
Hi,
This code is probably wrong.
I posted this fix to inbox because I was unsure how all these nested blocks worked.

It kind of works now, because the FontImporterTool opens.

Best,
Karl

No, it's good, just remove the extra ^ 
I'm not even sure that it does not work, but without it i'm sure that it works (i'm thinking of the ensure), so removal can avoid a brainstorm ;)


On Thu, Jan 3, 2019 at 10:58 PM Nicolas Cellier <[hidden email]> wrote:


Le jeu. 3 janv. 2019 à 22:34, <[hidden email]> a écrit :
A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-kfr.52.mcz

==================== Summary ====================

Name: TrueType-kfr.52
Author: kfr
Time: 3 January 2019, 10:34:19.705286 pm
UUID: 248937ad-7e63-4c27-b659-6165fdda9ffe
Ancestors: TrueType-pre.51

FontImporterTool would not open because 'Noto Color Emoji' error:  'File does not have a naming table'. 
Delete the font from FontPaths and continue

=============== Diff against TrueType-pre.51 ===============

Item was changed:
  ----- Method: TTFileDescription class>>openFontFile:do: (in category 'instance creation') -----
  openFontFile: fontFileName do: aBlock
        "Open the font with the given font file name"
        | fontFilePath file |
        fontFilePath := FontPaths at: fontFileName
                ifAbsentPut:[self findFontFile: fontFileName].
        fontFilePath ifNil:[^nil].
        file := [FileStream readOnlyFileNamed: fontFilePath] on: Error do:[:ex|
                "We lost the font; someone might have moved it away"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil].
+       [^[aBlock value: file binary]  on: Error do:[:ex|
+               "Error reading font. Skip it"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil] ] ensure:[file close].
does a ^ works well inside exception handling?
I think that just nil would do the work...
+       !
-               fontFilePath removeKey: fontFileName ifAbsent:[].
-               ^nil
-       ].
-       ^[aBlock value: file binary] ensure:[file close].!






Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: TrueType-kfr.52.mcz

Karl Ramberg
Both ^ must be there for the code to work.
Maybe assigning the block return value to a variable like in the line above would look less strange.
But then I'm not sure how to do the ensure: file closing.


Cheers,
Karl


On Fri, Jan 4, 2019 at 9:16 AM Nicolas Cellier <[hidden email]> wrote:


Le ven. 4 janv. 2019 à 06:57, karl ramberg <[hidden email]> a écrit :
Hi,
This code is probably wrong.
I posted this fix to inbox because I was unsure how all these nested blocks worked.

It kind of works now, because the FontImporterTool opens.

Best,
Karl

No, it's good, just remove the extra ^ 
I'm not even sure that it does not work, but without it i'm sure that it works (i'm thinking of the ensure), so removal can avoid a brainstorm ;)


On Thu, Jan 3, 2019 at 10:58 PM Nicolas Cellier <[hidden email]> wrote:


Le jeu. 3 janv. 2019 à 22:34, <[hidden email]> a écrit :
A new version of TrueType was added to project The Inbox:
http://source.squeak.org/inbox/TrueType-kfr.52.mcz

==================== Summary ====================

Name: TrueType-kfr.52
Author: kfr
Time: 3 January 2019, 10:34:19.705286 pm
UUID: 248937ad-7e63-4c27-b659-6165fdda9ffe
Ancestors: TrueType-pre.51

FontImporterTool would not open because 'Noto Color Emoji' error:  'File does not have a naming table'. 
Delete the font from FontPaths and continue

=============== Diff against TrueType-pre.51 ===============

Item was changed:
  ----- Method: TTFileDescription class>>openFontFile:do: (in category 'instance creation') -----
  openFontFile: fontFileName do: aBlock
        "Open the font with the given font file name"
        | fontFilePath file |
        fontFilePath := FontPaths at: fontFileName
                ifAbsentPut:[self findFontFile: fontFileName].
        fontFilePath ifNil:[^nil].
        file := [FileStream readOnlyFileNamed: fontFilePath] on: Error do:[:ex|
                "We lost the font; someone might have moved it away"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil].
+       [^[aBlock value: file binary]  on: Error do:[:ex|
+               "Error reading font. Skip it"
+               FontPaths removeKey: fontFileName ifAbsent:[].
+               ^nil] ] ensure:[file close].
does a ^ works well inside exception handling?
I think that just nil would do the work...
+       !
-               fontFilePath removeKey: fontFileName ifAbsent:[].
-               ^nil
-       ].
-       ^[aBlock value: file binary] ensure:[file close].!