freetype plugin on os-x squeak v5.0

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

freetype plugin on os-x squeak v5.0

johnmci
Ok, I compiled up a universal plugin  32bit PPC, 32/64Bit i386 FreeType plugin.

Its in the experimental/COCOA folder on my iDisk  http://homepage.mac.com/johnmci/FileSharing.html
FT2Plugin.2.3.11.TESTONLYNOTWORKINGFOR64.bundle.zip
UNzip and place that in the 64 bit VM for 32bit images Resource folder.

YOu can confirm it works by running the VM in 32bit mode, then switch to 64bit mode
and explore why it's broken.

Now I need someone to tell me where it fails when running as a 64bit VM with a 32bit image.
No doubt there is a primitive call that needs to be changed, but I'm a bit too tired now to
sort thru how the heck the FreeType class works to find out where it fails. (Silently I might add...)

Once we do that then we'll look at the plugin for a 64bit VM and 64bit Image

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: freetype plugin on os-x squeak v5.0

Henrik Sperre Johansen

On Dec 17, 2009, at 11:09 01AM, John M McIntosh wrote:

> Now I need someone to tell me where it fails when running as a 64bit VM with a 32bit image.
> No doubt there is a primitive call that needs to be changed, but I'm a bit too tired now to
> sort thru how the heck the FreeType class works to find out where it fails. (Silently I might add...)


It fails in FreeTypeFontProvider >> updateFromFileEntry: aDirectoryEntry directory: aFileDirectory locationType: aSymbol, on the primitive <primitive: 'primitiveNewFaceFromFileAndIndex' module: 'FT2Plugin'>.
The problem is that when loading fonts, this primitive is called for all files, and expected to fail for files not containing fonts...
So when it (like now) fails even on font files, then it fails silently.

Cheers,
Henry

Here's a small snippet that should make debugging it simpler from the image side (in case more than one primitive fails, after the first one is fixed :) )

Directory needs to be changed of course, the Font used is the one previously supplied with the Dev image:

file := DirectoryEntry name: 'DejaVuSans-Bold.ttf' creationTime: 3436368390 modificationTime: 3436368390 isDirectory: false fileSize: 572908.
directory := FileDirectory on: '/Users/henrikjohansen/Pharo/PharoCore-1.0-10477-BETA 2/Fonts/DejaVu'.

FreeTypeFontProvider current updateFromFileEntry: file directory: directory locationType: #imageRelative.




_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: freetype plugin on os-x squeak v5.0

johnmci
Ok, I spent a good 4 hours here working through issues.

Unfortunately the plugin just assumes an oops reference is a pointer (it's not), and that the squeak word size is (4), it might not be,
and the occasional FreeType variable is that an int or long?  FreeType defines their own var types so their code isn't confused, but we are...

Plus a sprinkling of self cCode: to do magic transformations between oops pointers and instance pointer values transformed to an int, or is that a long...

So it will be sometime yet before I get it working with a 64bit VM and 32bit image.

On 2009-12-17, at 3:16 AM, Henrik Johansen wrote:

>
> On Dec 17, 2009, at 11:09 01AM, John M McIntosh wrote:
>
>> Now I need someone to tell me where it fails when running as a 64bit VM with a 32bit image.
>> No doubt there is a primitive call that needs to be changed, but I'm a bit too tired now to
>> sort thru how the heck the FreeType class works to find out where it fails. (Silently I might add...)

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: freetype plugin on os-x squeak v5.0 -> goes to 5.1

johnmci
Ok after  a day of slugging thru bits between way too much turkey I reworked the freetype plugin code so that it now works with 64bit VMs running 32bit images.

There was a slight mistruth in the freetype header.

  /*************************************************************************/
  /*                                                                       */
  /* <Type>                                                                */
  /*    FT_Pos                                                             */
  /*                                                                       */
  /* <Description>                                                         */
  /*    The type FT_Pos is a 32-bit integer used to store vectorial        */
  /*    coordinates.  Depending on the context, these can represent        */
  /*    distances in integer font units, or 16.16, or 26.6 fixed float     */
  /*    pixel coordinates.                                                 */
  /*                                                                       */
  typedef signed long  FT_Pos;


Yes sure it's a 32bit number stored in a 64bit integer. Unfortunately when you map that to your handy IntegerArray instance, you get whiteness.
There were of course a few other places where "Oops" oops is a object reference, it's NOT a memory address, it can become one if you use the proper routine tho.
Once that was all corrected then it works.

I'm not able to check the FT2Plugin changes in yet because of a missing password.


Now in order to make this all work I had to recompile the Squeak VM so that it exposes the object memory base memory address so the plugin can find it.
So you'll find 5.1 at...

http://smalltalkconsulting.com/squeak.html

at the usual places, look in the experimental folder for the  "64bit"  directory then for the 64bit VM 32 bit image directory "32bitImage*64bitVM"
and the zipped VM "Squeak 64/32 5.1b1.app.zip"

Confirmation that it works elsewhere than my computer is welcome.  PS yes please check on 32bit intel, 32/64bit intel, and 32bit powerpc.

I'll build a 64bit version for 64bit images at some point in the future, but I think I'll look at the hostmenu logic first to get mac menus back.

On 2009-12-20, at 6:16 PM, John M McIntosh wrote:

> Ok, I spent a good 4 hours here working through issues.
>
> Unfortunately the plugin just assumes an oops reference is a pointer (it's not), and that the squeak word size is (4), it might not be,
> and the occasional FreeType variable is that an int or long?  FreeType defines their own var types so their code isn't confused, but we are...
>
> Plus a sprinkling of self cCode: to do magic transformations between oops pointers and instance pointer values transformed to an int, or is that a long...
>
> So it will be sometime yet before I get it working with a 64bit VM and 32bit image.
>
> On 2009-12-17, at 3:16 AM, Henrik Johansen wrote:
>
>>
>> On Dec 17, 2009, at 11:09 01AM, John M McIntosh wrote:
>>
>>> Now I need someone to tell me where it fails when running as a 64bit VM with a 32bit image.
>>> No doubt there is a primitive call that needs to be changed, but I'm a bit too tired now to
>>> sort thru how the heck the FreeType class works to find out where it fails. (Silently I might add...)
>
> --
> ===========================================================================
> John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================
>
>
>
>

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================





_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: freetype plugin on os-x squeak v5.0 -> goes to 5.1

David T. Lewis
On Fri, Dec 25, 2009 at 08:23:53PM -0800, John M McIntosh wrote:
> Ok after  a day of slugging thru bits between way too much turkey I reworked the freetype plugin code so that it now works with 64bit VMs running 32bit images.
>

Excellent!

> Now in order to make this all work I had to recompile the Squeak VM so that it exposes the object memory base memory address so the plugin can find it.
> So you'll find 5.1 at...
>
> http://smalltalkconsulting.com/squeak.html

Please feel free to add this to SqS/VMMaker, and bump VMMaker class>>versionString
up by one minor number. Or if you prefer, I can add it if you point me to a
change set.

Thanks,
Dave


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project