pure-data / pdfontloader

tiny TCL extension to load fonts into the Pure Data GUI on Windows
2 stars 2 forks source link

Needs testing #5

Open danomatika opened 6 years ago

danomatika commented 6 years ago

ping @Lucarda @Spacechild1 @umlaeute

pdfontloader working

This needs testing. I have it working and added info to the README on how to build & test.

To make things easier, here is pdfontloader pre-built: pdfontloader.zip

Lucarda commented 6 years ago

@danomatika

Good is working!!! : )

The tcl part did not work for me so I changed to:

load ./pdfontloader.dll
            pdfontloader::load pd/lib/font/DejaVuSansMono.ttf
            pdfontloader::load pd/lib/font/DejaVuSansMono-bold.ttf
            #

pdfontloader.dll was placed on pd/lib

Note that on windows using only the “DejaVuSansMono.ttf”, when using “Bold”, fonts render bad (smaller and uglier), so “DejaVuSansMono-bold.ttf” must also be shipped.

danomatika commented 6 years ago

Put pdfontloader.dll in /bin and the ttf in /font and it should work. At least it did for me. The idea is to keep the compiled libs in bin. This may not work of pd is installed via make install, but that can be changed later.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Dec 18, 2017, at 8:29 PM, Lucas Cordiviola notifications@github.com wrote:

@danomatika

Good is working!!! : )

The tcl part did not work for me so I changed to:

load ./pdfontloader.dll pdfontloader::load pd/lib/font/DejaVuSansMono.ttf pdfontloader::load pd/lib/font/DejaVuSansMono-bold.ttf # pdfontloader.dll was placed on pd/lib

Note that on windows using only the “DejaVuSansMono.ttf”, when using “Bold”, fonts render bad (smaller and uglier), so “DejaVuSansMono-bold.ttf” must also be shipped.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Lucarda commented 6 years ago

Ok,

I got it working. But I'm also loading the bold font:

            # load local font
            if {[file exists [file join "$::sys_libdir" "font"]]} {
                catch {
                    load [file join "$::sys_libdir" "bin/pdfontloader.dll"]
                    set path [file join "$::sys_libdir" "font/DejaVuSansMono.ttf"]
                    set path2 [file join "$::sys_libdir" "font/DejaVuSansMono-Bold.ttf"]
                    pdfontloader::load $path
                    pdfontloader::load $path2
                    ::pdwindow::verbose 0 "pdfontloader loaded [file tail $path]\n"
                }
            }

. . .

This is how bold renders if NOT shipping/loading “DejaVuSansMono-Bold.ttf": .

uglynoboldttf . . .

This is the "nice" and correct render when using “DejaVuSansMono-Bold.ttf" .

niceboldttf

Lucarda commented 6 years ago

This may not work of pd is installed via make install, but that can be changed later.

I think everything will run fine if we include the files in the correct places using the “pdprototype.tgz”, the "font" folder can be included there. The script decompresses everything.

Also I think there's no need to compile “pdfontloader.dll” every time we compile Pd.

danomatika commented 6 years ago

I would put the compiled extension in the tarball but not the font folder as it is required for the mac app build.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Dec 18, 2017, at 9:43 PM, Lucas Cordiviola notifications@github.com wrote:

This may not work of pd is installed via make install, but that can be changed later.

I think everything will run fine if we include the files in the correct places using the “pdprototype.tgz”, the "font" folder can be included there. The script decompresses everything.

Also I think there's no need to compile “pdfontloader.dll” every time we compile Pd.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Lucarda commented 6 years ago

We can put the fonts in the tarball and have the 2 fonts in the bin dir.

Lucarda commented 6 years ago

I have moved the font files to the pd/bin.

I removed some lines on the tcl the:

if {[file exists [file join "$::sys_libdir" "font"]]} {

and

::pdwindow::verbose 0 "pdfontloader loaded [file tail $path]\n"

Everything's fine with:

            # load local font
            catch {
                    load [file join "$::sys_libdir" "bin/pdfontloader.dll"]
                    set path [file join "$::sys_libdir" "bin/DejaVuSansMono.ttf"]
                    set path2 [file join "$::sys_libdir" "bin/DejaVuSansMono-Bold.ttf"]
                    pdfontloader::load $path
                    pdfontloader::load $path2

                }
danomatika commented 6 years ago

No. The fonts should stay in the font folder to match the layout in the git repo. They are resource files and don't need to go in bin.

enohp ym morf tnes

Dan Wilcox danomatika.com robotcowboy.com

On Dec 18, 2017, at 11:48 PM, Lucas Cordiviola notifications@github.com wrote:

I have moved the font files to the pd/bin.

I removed some lines on the tcl the:

if {[file exists [file join "$::sys_libdir" "font"]]} {

and

::pdwindow::verbose 0 "pdfontloader loaded [file tail $path]\n"

Everything's fine with:

        # load local font
        catch {
                load [file join "$::sys_libdir" "bin/pdfontloader.dll"]
                set path [file join "$::sys_libdir" "bin/DejaVuSansMono.ttf"]
                set path2 [file join "$::sys_libdir" "bin/DejaVuSansMono-Bold.ttf"]
                pdfontloader::load $path
                pdfontloader::load $path2

            }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Lucarda commented 6 years ago

I think if we don't want to make changes in Miller's and Christof's makefiles we can include the font folder in the tarball.

But may be you have other plans.

danomatika commented 6 years ago

I do. This needs to be added so that it is easy to build and update by everyone. We'll make some changes on that soon enough.

Lucarda commented 6 years ago

I think the goal of pdfontloader is to include the binary and the fonts ready to use by the app.

If someone wants to change/compile pdfontloader he/she can look here (https://github.com/pure-data/pdfontloader) for the sources and get the tcl headers and happily build.

Are you planning to build pdfontloader every time a Pd for windows is built?

umlaeute commented 6 years ago

i fail to see how this (how often it is build or not) is relevant. (for what it is worth, i'd rather have it build every time: the more CI the merrier)

danomatika commented 6 years ago

If this is working and accepted, my overall plan was to add this folder inside the msw directory in the main repository. It can then be an additional build target. I don't think it needs to be a built every time, only conditional, with the binary included inside a pre-built pdprototype.tgz, to follow the existing setup so far. Later on, we can move to making it a build each time in addition to some scripting to build Tcl/Tk for Windows.

This has been my approach to the macOS build: flesh out the tools (aka scripts) to build the required platform frameworks so that people can experiment and we have working methods if/when we ned to transition the default release build. This worked rather well when Miller decided to move Pd to Tk 8.5 on macOS in the 0.48 release.

On Dec 29, 2017, at 10:07 AM, umläute notifications@github.com wrote:

i fail to see how this is relevant. (for what it is worth, i'd rather have it build every time: the more CI the merrier)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pure-data/pdfontloader/issues/5#issuecomment-354419139, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdVfVUEbOMCLHXeE6GPOJdglF8hIo0Qks5tFKvigaJpZM4RF1dq.


Dan Wilcox @danomatika http://twitter.com/danomatika danomatika.com http://danomatika.com/ robotcowboy.com http://robotcowboy.com/

danomatika commented 6 years ago

Also, I confirm we need to add the bold DVSM ttf. I can do that when I make the PR which adds this Tcl extension to the Pd repo.