Closed dredknight closed 7 years ago
here's what the manual does
font "#{DIR}/fonts/Coolvetica.ttf" unless Shoes::FONTS.include? "Coolvetica"
DIR is where Shoes is installed and fonts is directory in there.
Alright, I tried this out:
font "text/fonts/vivaldi.ttf" unless Shoes::FONTS.include? "Vivaldi"
debug("#{Shoes::FONTS.include? "Vivaldi"}")
style Shoes::Subtitle, font: "Vivaldi"
debug says true! but the Subtitle text do not change. Why is that happening? This happens on Windows 7 system.
This works fine when the font is loaded manually on the system.
style Shoes::Subtitle, font: "Vivaldi"
Have anyone used this font thing actually?
Just for fun, copy the Coolvetica font c:"program files (x86)\Shoes\fonts\ to your text/fonts and change and see if it will load in place of your vivaldi.ttf. If if works then we know that there's something in you ttf that Shoes doesn't like. If the font is loaded into Windows, Shoes gets from a different path in the code.
font "#{DIR}/fonts/Coolvetica.ttf" unless Shoes::FONTS.include? "Coolvetica.ttf"
debug("#{Shoes::FONTS.include? "Coolvetica"}")
style Shoes::Subtitle, font: "Coolvetica"
I tried both ways - take it from program directory and directly from Shoes font directory - but no success.
Actually here is my 0.7 version of the code - https://gist.github.com/dredknight/1f7985976c4fad6a3036 And here is a preproduction - exe file
The files that the code uses are in the exe file so just unzip and unshy it :). There are a few things which are not yet ok.
Coolvettica doesn't load?!? Does the manual look OK? because it does load the font - see help.rb inside shoes\lib\shoes Font handling on Windows has been a big source of problems so I don't discount that their are errors still.
I don't have a dropbox account and unlikely to get one.
'''ruby Shoes.app { para Shoes::FONTS para "\n----------------------------------------------\n" para "#{Shoes::FONTS}\n" para "\n----------------------------------------------\n" font "vivaldi.ttf" para "#{Shoes::FONTS}\n", font: "Vivaldi" para "\n..............................................\n" Shoes::FONTS.each {|ft| info ft} } Displays on Linux, doesn't display on Win 7.
@ccoupe no need for a dropbox account :). there is a button called " No thanks, continue to view → " where you can download the file.
Actually Coolvetica loads (Vivaldi also get loaded). I mean the compiler responds with "true" but there is no change in the text nor you can see the font in windows "Fonts".
Let me know if I can assist in some way.
As expected, this is a another damn font bug on windows. I don't want to go back to the older fontconfig mess - that would fix this problem but annoy every windows user with slow or inconsistent startup and other oddities when using the command line.
The work around is as you've discovered, install the font in Windows. If you get close to shipping the app and the bug isn't fixed, then you'll have to package using the merge method. which means you'd have to deal with adding an install font step to your NSIS script. If any of your users are on win 10, you'll probably have to do the exe-shoes thing eventually even if this bug does get fixed.
Installing shoes compiler is set as prerequisite for using the app so that is ok. I will have to learn the Nsis thing now but I guess it is not that complicated.
Thanks for all the help :)!
I've got a font fix that works for me. @dredknight if you would be so kind, try out this 3.3.2 beta . You'll have to uninstall your current Shoes first. If you want to revert, then uninstall 3.3.2 and re-install the one you had.
I use a simple test script which requires vivaldi.ttf to be in the same dir as the this script
Shoes.app {
font "vivaldi.ttf"
para "#{Shoes::FONTS}\n", font: "Vivaldi"
para "#{Shoes::FONTS}\n", font: "Symbol"
para "\n..............................................\n"
button "quit" do exit end
}
Requiring your users to install Shoes first and then download and run your .shy works just fine on Windows 10. If that fits your desire, then don't go into the NSIS rabbit hole before you need too.
It works!!!! Yes, only in the folder of the script.
Good! Thanks for reporting the bug. I'll leave the issue open until I merge the change into the next release.
font will work with a partial or full path. The test script is only a test.
Glad to hear :)! Well done on the fix!
Closed in Shoes 3.3.2
Hello everyone,
I am using a font that is not always available on windows systems. Searching for a method to load the font, shoes provides such but unfortunately it is not documented how exactly to use it. Here is the article -> http://shoesrb.com/manual/Built-in.html#font
A few iterations of this were tried but nothing happened:
font ("path-to-file.ttf") font (path-to-file.ttf) font path-to-file.ttf