Jimdo / angular-fontselect

A fontselect directive for AngularJS
MIT License
29 stars 9 forks source link

Specific fonts from list? #47

Open tushar-borole opened 8 years ago

tushar-borole commented 8 years ago

What if i want to keep specfic fonts, not all fonts for example only helvetica, what should i do?

Xiphe commented 8 years ago

you could digg yourself through the (not at all documented [ref #34]) fontsService

it holds all fonts and all font providers

have not tested that but it should work s.th. like this

myAngularApp.run(function(jdFontselectFonts) {
  angular.forEach(jdFontselectFonts.getAllFonts(), function(fontObj) {
    if (fontObj.key !== 'helvetica') {
      jdFontselectFonts.removeFont(fontObj); 
    }
  });
});
Xiphe commented 8 years ago

we could also refactor the font-provider pattern (see service.fonts.js#L38-L39) and make it truely configurable, allowing you to disable all default providers and add your own