Use method tags.  See e.g. Travis Griggs' assets framework.  You could use
something like

courierNewBoldttf
    <fontName: 'Courier New Bold.ttf'
    encoding: 'gzip'
    data:
'AAEAAAATAQAABAAwRFNJR0rTjTkACiUQAAAbgEdERUYTqQ1VAApAkAAAAkxHUE9T3wr9iAAK
QtwAADeeR1NVQgwWqYIACnp8AAAT1k9TLzIQrF1xAAABuAAAAGBWRE1YNVhPeQAAGrwAABGU
Y21hcHepKTsAACxQAAAhqmN2dCCka4hDAABqbAAACA5mcGdtUXaa9wAATfwAAAdZZ2FzcAAW
AAkACiUAAAAAEGdseWbVwXRoAACjvAAI9Z5oZWFk05ZxuQAAATwAAAA2aGhlYQrAAZoAAAF0
.......... '.

and extracting the data is easy.

On Tue, Oct 19, 2010 at 4:06 AM, nullPointer <[email protected]> wrote:

>
> Hi
>
> I´m doing a class for embed files in class methods. I want know if exists a
> best way for do that task than I´m using... I do something like that...
>
>
>           codeSource := CLStringBuilder new.
>                codeSource appendLine: nameOfResource; tab;
>                                        appendFormat: '^''{1}'' -> '''
> withValues: {fileName}.
>
>                readStream := FileStream readOnlyFileNamed: aFilePath.
>
>                base64Contents := (Base64MimeConverter mimeEncode:
> readStream binary)
> contents.
>
>                codeSource append: base64Contents asString.
>                codeSource append:''''.
>
>                CLSystem createMessageInClass: self
>                        withCodeSource: (codeSource asString)
>                        inProtocol: 'resources'
>                        inClassSide: true.
>
>
> I get the next result:
>
> courierNewBoldttf
>
>        ^'Courier New Bold.ttf' ->
> 'AAEAAAATAQAABAAwRFNJR0rTjTkACiUQAAAbgEdERUYTqQ1VAApAkAAAAkxHUE9T3wr9iAAK
> QtwAADeeR1NVQgwWqYIACnp8AAAT1k9TLzIQrF1xAAABuAAAAGBWRE1YNVhPeQAAGrwAABGU
> Y21hcHepKTsAACxQAAAhqmN2dCCka4hDAABqbAAACA5mcGdtUXaa9wAATfwAAAdZZ2FzcAAW
> AAkACiUAAAAAEGdseWbVwXRoAACjvAAI9Z5oZWFk05ZxuQAAATwAAAA2aGhlYQrAAZoAAAF0
> .......... '.
>
>
> Exists a enhanced way for do that? My main problem is the image grow very
> much. When I export to Monticello I get a file of 900 KB. When embed a file
> of 600KB the final size on Monticello file is 2MB!! and almost 4MB of
> difference in size of image  :(
>
> Many thanks for the help
>
>
>
> --
> View this message in context:
> http://forum.world.st/Best-way-for-embed-a-file-on-Smalltalk-image-method-tp3001915p3001915.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to