Hi,
The reason I took this path was because this is how we are dealing with
pictures as well. Furthermore, the fonts are downloaded from sourceforge
and that is neither the fastest nor the most reliable site. As Stef said,
if we are worried about the size, we can easily unload the package after
installing. So, for me, the current solution is simple and as reliable as
any other Pharo code. In other words, if SmalltalkHub fails, many other
things will fail before the fonts become an issue.
Nevertheless, it could be interesting to create an index class that can
build fonts on the fly based on a url. For this, we would need a repository
somewhere reliable :).
About the easiness of compiling the binary file, there already exists a
utility documented on my blog post:
Gofer new
smalltalkhubUser: 'girba' project: 'FreeFonts';
package: 'FontInstaller';
load.
fontDirectory := FileSystem workingDirectory / 'Fonts' /
'SourceCodePro_FontsOnly-1.017'.
FontInstaller new
installFromDirectory: fontDirectory / 'TTF'
url: 'http://sourceforge.net/projects/sourcecodepro.adobe/'
license: ((fontDirectory / 'LICENSE.txt') readStreamDo: #contents).
Cheers,
Doru
On Wed, May 15, 2013 at 9:42 AM, stephane ducasse
<stephane.ducasse(a)free.fr>wrote;wrote:
On May 15, 2013, at 1:11 AM, Igor Stasenko <siguctua(a)gmail.com> wrote:
On 15 May 2013 00:57, Igor Stasenko
<siguctua(a)gmail.com> wrote:
> Hi , Doru
>
> i have only one question: why you put font binary data into compiled
method?
> That means that in object memory it will be
contained 3 times:
> - 1 as source code
> - 2 as big literal array
> - 3 in freetype memory buffer
>
> imo, #fontContents should be
>
> fontContents
> ^ self url getContents ".. or whatever.. url is key here"
>
>
> ... or you can download the binaray data and put it into class var
> (lazy-initialized etc)..
> but do not hold binary data as source code.. this is really awful idea
as to
me.
unless
you worry that longevity of your file copy @ smalltalk-hub will
be higher than
longevity on site where you downloaded it from.
or even better,
at class #initialize you forcefully downloading font from its original
web site and put it into
some class var.
Do you care? Because I like the idea to have self contained package.
We can do the inverse: remove the method once the fonts are installed?
I do not want to rely on a web connection to get the system working.
Since package is also downloaded from internet,
there's no worry that
font will be unavailable
during installation (unless the site where it located changes file
location).
Like that, the package will contain just minimum
necessary bits to
install the font.
And also, having url available, makes it easier for users to add own
fonts by simply overriding it,
without need of figuring out how to turn a binary file into method's
source code.
I would provide a helper method that compile the contents into a method.
--
Best regards,
Igor Stasenko.
--
Best regards,
Igor Stasenko.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev