Once again: Fontconfig and NSIS #216

Closed
ccoupe opened this Issue Mar 6, 2016 · 8 comments

Comments

Projects
None yet
2 participants
@ccoupe
Contributor

ccoupe commented Mar 6, 2016

The base.nsi sets the FONTCONFIG_FILE path at install and deletes it at uninstall. Which is OK if that is the only Shoes or Shoes derived app using the Env var/Registry Entry. When you have two apps that use that, one of them is in danger when the other is uninstalled. Default nsis behavior is to append the path to the reg key if its already there which sort of works if the first path is still good. Fun arrives when you uninstal one of those two apps. There's lots hacks and workaround that almost seem to work. Been there. Still there.

I think there should have a single %APPDATALOCAL% location for the fontconfig files instead of inside each installed Shoes-like exe. At install time, if the registry key is missing OR if they key contains two or more paths , create the appdata dirs, copy the .etc\font* files, set the key/replace the key with the appdata location and run fc-cache.exe. When an app is removed, don't delete the registry key. I think this would be backwards compatible with existing Shoes 3.2 installs and it would allow Shoes developers to have multiple copies of Shoes (or Shoes derived exe) installed. You could actually try a beta without uninstalling Shoes.

I have no idea how to tell NSIS to do that - my mind shut down when I learned the last arg to nsis StrCmp is the number of lines in the script to skip. Not even a goto! A skip!

[Update]
It's also worth noting That Geany (my Linux code editor of choice) works on Windows (it's a gtk2/pango creature) and it appears not to need fontconfig in order to find fonts on Windows. Geany also claims to have an OSX version but I haven't tried it. Perhaps fontconfig really isn't needed anymore?

@ccoupe ccoupe added this to the 3.3.2 milestone Mar 8, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 8, 2016

Contributor

It appears (see #48) the reason for fontconfig, fc-cache & friends on Windows is the loading of the ttf fonts included with Shoes, CoolVetica and Lacuna . As you might expect, I don't care deeply about these fonts appearance if the there is something commonly available and close. I suspect the Shoes ability to load fonts from a user supplied .ttf is a HacketyHack thing and never used by any one but _why

Considering the grief inflicted by FONTCONFIG_FILE and fc-cache.exe on all Shoes/Windows users, and [core] developers, perhaps why should dump it. Windows can load and create font names like it did in 3.1 (native) - gtk.c already has #ifdef for windows only code, I may be conflating two or more font issues but I do like the idea of just getting rid of painful things that aren't used.

Contributor

ccoupe commented Mar 8, 2016

It appears (see #48) the reason for fontconfig, fc-cache & friends on Windows is the loading of the ttf fonts included with Shoes, CoolVetica and Lacuna . As you might expect, I don't care deeply about these fonts appearance if the there is something commonly available and close. I suspect the Shoes ability to load fonts from a user supplied .ttf is a HacketyHack thing and never used by any one but _why

Considering the grief inflicted by FONTCONFIG_FILE and fc-cache.exe on all Shoes/Windows users, and [core] developers, perhaps why should dump it. Windows can load and create font names like it did in 3.1 (native) - gtk.c already has #ifdef for windows only code, I may be conflating two or more font issues but I do like the idea of just getting rid of painful things that aren't used.

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Mar 8, 2016

Collaborator

User fonts make sense in deployment scenarios.

Collaborator

BackOrder commented Mar 8, 2016

User fonts make sense in deployment scenarios.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 8, 2016

Contributor

Too soon to say if user fonts can't be accommodated. They were in in the old code. Consider the Win10 deployment issues (forever broken) and the security issues with user fonts, W/o a signed app which Shoes can't do it's not going work in the future and it's a hell of pain now, that _may not _be needed. If a deployment persons needs to install fonts on Windows, they have their own NSIS to work with.

Contributor

ccoupe commented Mar 8, 2016

Too soon to say if user fonts can't be accommodated. They were in in the old code. Consider the Win10 deployment issues (forever broken) and the security issues with user fonts, W/o a signed app which Shoes can't do it's not going work in the future and it's a hell of pain now, that _may not _be needed. If a deployment persons needs to install fonts on Windows, they have their own NSIS to work with.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 9, 2016

Contributor

Looking at the code/obj-c it looks to me like OSX 10.9+ doesn't really work if a Shoes script attempts to load a font - I don't see where I add it to the ruby array that is the shoes font list. if true, that might be a gauge of how often users to that on OSX. If true. On the happy side of the ledger, that font list is just a Ruby array of ruby strings. (presumably the string is parsed by pango font descriptors) so the old shoe_load_font from Shoes 3.1 for Windows should work and only linux needs fontconfig. Certainly worth trying. I've created a remote branch 'fonts' since this could change things a lot for Windows and will take some time.

Contributor

ccoupe commented Mar 9, 2016

Looking at the code/obj-c it looks to me like OSX 10.9+ doesn't really work if a Shoes script attempts to load a font - I don't see where I add it to the ruby array that is the shoes font list. if true, that might be a gauge of how often users to that on OSX. If true. On the happy side of the ledger, that font list is just a Ruby array of ruby strings. (presumably the string is parsed by pango font descriptors) so the old shoe_load_font from Shoes 3.1 for Windows should work and only linux needs fontconfig. Certainly worth trying. I've created a remote branch 'fonts' since this could change things a lot for Windows and will take some time.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 9, 2016

Contributor

Using the test prog from #218 and the old windows.c font code (no fontconfig calls on Windows). Shoes is not installed. FONTCONFIG_FILE is not defined.
win7
Speedy too. I'll need to do more work and testing make sure fontconfig is not part of Shoes/Windows but it looks promising.

Contributor

ccoupe commented Mar 9, 2016

Using the test prog from #218 and the old windows.c font code (no fontconfig calls on Windows). Shoes is not installed. FONTCONFIG_FILE is not defined.
win7
Speedy too. I'll need to do more work and testing make sure fontconfig is not part of Shoes/Windows but it looks promising.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 9, 2016

Contributor

With FontConfig, here's what that test script looks like (it gained a quit button)
win7-fc

170 vs 137 - which is correct? Windows Control Panel says there are a 134 fonts on my system.

Contributor

ccoupe commented Mar 9, 2016

With FontConfig, here's what that test script looks like (it gained a quit button)
win7-fc

170 vs 137 - which is correct? Windows Control Panel says there are a 134 fonts on my system.

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 9, 2016

Contributor

Slightly better test program - it can display all the fonts (takes a few seconds on all platforms). The bulk of the differing counts on windows native vs fontconfig appears to be handling fontnames that start with '@' Hoo-Kay. They all work (no errors on the consoles) but the fontconfig code can produce some odd sizes when rendered.

Since I want to dump fontconfig on Windows, I may not be looking at the this properly so please speak up.

Shoes.app do
  @dsp = stack do
    all_fonts = Shoes::FONTS
    para "#{all_fonts.length} fonts [0]: #{all_fonts[0]} [-1]: #{all_fonts[-1]}"
    para "Lacuna? #{all_fonts.include? 'Lacuna Regular'}"
    lac = font "#{DIR}/fonts/Lacuna.ttf"
    para "Loaded: #{lac.inspect}"
    new_fonts = Shoes::FONTS
    para "#{new_fonts.length} fonts [0]: #{new_fonts[0]} [-1]: #{new_fonts[-1]}"
    para "Lacuna? #{new_fonts.include? 'Lacuna Regular'}" 
    at_cnt = 0
    flow do 
      button "display all" do
        new_fonts.each do |fontname| 
          @dsp.append do
            if fontname[0].chr == '@'
              at_cnt = at_cnt + 1
            else
              para "#{fontname} Shoes is fun!", font: fontname
            end
          end
        end 
        para "skipped #{at_cnt} fonts starting with @"
      end 
      button "quit" do
        exit
      end
    end
  end
end
Contributor

ccoupe commented Mar 9, 2016

Slightly better test program - it can display all the fonts (takes a few seconds on all platforms). The bulk of the differing counts on windows native vs fontconfig appears to be handling fontnames that start with '@' Hoo-Kay. They all work (no errors on the consoles) but the fontconfig code can produce some odd sizes when rendered.

Since I want to dump fontconfig on Windows, I may not be looking at the this properly so please speak up.

Shoes.app do
  @dsp = stack do
    all_fonts = Shoes::FONTS
    para "#{all_fonts.length} fonts [0]: #{all_fonts[0]} [-1]: #{all_fonts[-1]}"
    para "Lacuna? #{all_fonts.include? 'Lacuna Regular'}"
    lac = font "#{DIR}/fonts/Lacuna.ttf"
    para "Loaded: #{lac.inspect}"
    new_fonts = Shoes::FONTS
    para "#{new_fonts.length} fonts [0]: #{new_fonts[0]} [-1]: #{new_fonts[-1]}"
    para "Lacuna? #{new_fonts.include? 'Lacuna Regular'}" 
    at_cnt = 0
    flow do 
      button "display all" do
        new_fonts.each do |fontname| 
          @dsp.append do
            if fontname[0].chr == '@'
              at_cnt = at_cnt + 1
            else
              para "#{fontname} Shoes is fun!", font: fontname
            end
          end
        end 
        para "skipped #{at_cnt} fonts starting with @"
      end 
      button "quit" do
        exit
      end
    end
  end
end

ccoupe added a commit that referenced this issue Mar 9, 2016

remove fontconfig_file env var. #216
* more to test and remove

@ccoupe ccoupe modified the milestones: 3.3.1, 3.3.2 Mar 10, 2016

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Mar 10, 2016

Contributor

This seems to work really well but you must get rid of the FONTCONFIG_FILE env var or pango will use it and fail. The fontconfig.dll still has be part of Shoes because other deps require it.

Contributor

ccoupe commented Mar 10, 2016

This seems to work really well but you must get rid of the FONTCONFIG_FILE env var or pango will use it and fail. The fontconfig.dll still has be part of Shoes because other deps require it.

@ccoupe ccoupe closed this Apr 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment