From 639027df0c0e23c6b7874325a21348bb3ff5592e Mon Sep 17 00:00:00 2001 From: Aristeides Stathopoulos Date: Sat, 17 Mar 2018 18:29:16 +0200 Subject: [PATCH] removing fontdeck --- CONTRIBUTING.md | 2 +- README.md | 15 +--- Rakefile | 4 +- lib/webfontloader/demo/public/fontdeck.html | 75 ---------------- lib/webfontloader/demo/public/index.html | 2 - spec/deps.js | 3 +- spec/index.html | 1 - spec/modules/fontdeck_spec.js | 99 --------------------- src/core/initialize.js | 12 --- src/modules.yml | 3 - src/modules/fontdeck.js | 66 -------------- webfontloader.gemspec | 3 - 12 files changed, 5 insertions(+), 280 deletions(-) delete mode 100644 lib/webfontloader/demo/public/fontdeck.html delete mode 100644 spec/modules/fontdeck_spec.js delete mode 100644 src/modules/fontdeck.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1592325..1cd97c33 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ If you want to build a JS file with only specific modules you can specify them o $ rake compile['custom google typekit'] -This will compile a JS file with only the `custom`, `google` and `typekit` modules. The available modules are: `custom`, `google`, `typekit`, `ascender`, `monotype`, `fontdeck`. By default all modules are included. +This will compile a JS file with only the `custom`, `google` and `typekit` modules. The available modules are: `custom`, `google`, `typekit`, `ascender`, `monotype`. By default all modules are included. ## Demos diff --git a/README.md b/README.md index 097b841e..c27b3796 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Web Font Loader -Web Font Loader gives you added control when using linked fonts via `@font-face`. It provides a common interface to loading fonts regardless of the source, then adds a standard set of events you may use to control the loading experience. The Web Font Loader is able to load fonts from [Google Fonts](http://www.google.com/fonts/), [Typekit](http://www.typekit.com/), [Fonts.com](http://www.fonts.com/), and [Fontdeck](http://fontdeck.com/), as well as self-hosted web fonts. It is co-developed by [Google](http://www.google.com/) and [Typekit](http://www.typekit.com). +Web Font Loader gives you added control when using linked fonts via `@font-face`. It provides a common interface to loading fonts regardless of the source, then adds a standard set of events you may use to control the loading experience. The Web Font Loader is able to load fonts from [Google Fonts](http://www.google.com/fonts/), [Typekit](http://www.typekit.com/) and [Fonts.com](http://www.fonts.com/), as well as self-hosted web fonts. It is co-developed by [Google](http://www.google.com/) and [Typekit](http://www.typekit.com). [![Build Status](https://travis-ci.org/typekit/webfontloader.svg?branch=master)](https://travis-ci.org/typekit/webfontloader) @@ -14,7 +14,6 @@ Web Font Loader gives you added control when using linked fonts via `@font-face` * [Modules](#modules) * [Adobe Edge Web Fonts](#adobe-edge-web-fonts) * [Custom](#custom) - * [Fontdeck](#fontdeck) * [Fonts.com](#fontscom) * [Google](#google) * [Typekit](#typekit) @@ -275,18 +274,6 @@ WebFontConfig = { Tests strings should be specified on a per font basis and contain at least one character. If not specified the default test string (`BESbswy`) is used. -### Fontdeck - -To use the [Fontdeck](http://fontdeck.com/) module, specify the ID of your website. You can find this ID on the website page within your account settings. - -```javascript -WebFontConfig = { - fontdeck: { - id: 'xxxxx' - } -}; -``` - ### Fonts.com When using [Fonts.com web fonts](http://www.fonts.com/web-fonts/) specify your Project ID. diff --git a/Rakefile b/Rakefile index adb2d5c4..3b88e8c3 100644 --- a/Rakefile +++ b/Rakefile @@ -88,7 +88,7 @@ file "webfontloader.js" => "target/webfont.js" do end file "target/webfont.js", [:modules] => SourceJs + ["target"] do |t, args| - args.with_defaults(:modules => 'custom google typekit monotype fontdeck') + args.with_defaults(:modules => 'custom google typekit monotype') modules = args[:modules].split ' ' @@ -125,7 +125,7 @@ desc "Creates debug version into target/webfont.js" task :debug, [:modules] => "target/webfont_debug.js" file "target/webfont_debug.js", [:modules] => SourceJs + ["target"] do |t, args| - args.with_defaults(:modules => 'custom google typekit monotype fontdeck') + args.with_defaults(:modules => 'custom google typekit monotype') modules = args[:modules].split ' ' diff --git a/lib/webfontloader/demo/public/fontdeck.html b/lib/webfontloader/demo/public/fontdeck.html deleted file mode 100644 index 93ea7d8a..00000000 --- a/lib/webfontloader/demo/public/fontdeck.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - -

Hello World. I am Fertigo Pro Regular.

-

Hello World. I am Bodoni Display Bold Italic.

-
-

- Hide Page | - Reload Cached -

-

- The goal of this page is to show how Fontdeck fonts load. -

-

- You must use "localhost" when testing Fontdeck fonts. -

-
    - - diff --git a/lib/webfontloader/demo/public/index.html b/lib/webfontloader/demo/public/index.html index 98f8ced0..6ff9fad4 100644 --- a/lib/webfontloader/demo/public/index.html +++ b/lib/webfontloader/demo/public/index.html @@ -23,7 +23,6 @@

    Modules

  1. Google / Web Font Loader: Load fonts from Google with Web Font Loader.
  2. Typekit / Web Font Loader: Load fonts from Typekit with Web Font Loader.
  3. Custom / Web Font Loader: Load fonts from your own CSS with Web Font Loader.
  4. -
  5. Fontdeck / Web Font Loader: Load fonts from Fontdeck with Web Font Loader.
  6. Monotype / Web Font Loader: Load fonts from fonts.com with Web Font Loader.
  7. @@ -35,7 +34,6 @@

    Modules in Iframes

  8. Google / Web Font Loader: Load fonts from Google in a child iframe with Web Font Loader.
  9. Typekit / Web Font Loader: Load fonts from Typekit in a child iframe with Web Font Loader.
  10. Custom / Web Font Loader: Load fonts from your own CSS in a child iframe with Web Font Loader.
  11. -
  12. Fontdeck / Web Font Loader: Their demo fonts seem to be broken at the moment, so we don't have an iframe demo of this module.
  13. Monotype / Web Font Loader: Load fonts from fonts.com in a child iframe with Web Font Loader.
  14. diff --git a/spec/deps.js b/spec/deps.js index e57cfb02..360a4cb0 100644 --- a/spec/deps.js +++ b/spec/deps.js @@ -10,11 +10,10 @@ goog.addDependency("../../src/core/fontmoduleloader.js", ["webfont.FontModuleLoa goog.addDependency("../../src/core/fontruler.js", ["webfont.FontRuler"], []); goog.addDependency("../../src/core/fontwatcher.js", ["webfont.FontWatcher"], ["webfont.FontWatchRunner","webfont.NativeFontWatchRunner"]); goog.addDependency("../../src/core/fontwatchrunner.js", ["webfont.FontWatchRunner"], ["webfont.Font","webfont.FontRuler"]); -goog.addDependency("../../src/core/initialize.js", ["webfont"], ["webfont.WebFont","webfont.modules.Typekit","webfont.modules.Fontdeck","webfont.modules.Monotype","webfont.modules.Custom","webfont.modules.google.GoogleFontApi"]); +goog.addDependency("../../src/core/initialize.js", ["webfont"], ["webfont.WebFont","webfont.modules.Typekit","webfont.modules.Monotype","webfont.modules.Custom","webfont.modules.google.GoogleFontApi"]); goog.addDependency("../../src/core/nativefontwatchrunner.js", ["webfont.NativeFontWatchRunner"], ["webfont.Font"]); goog.addDependency("../../src/core/webfont.js", ["webfont.WebFont"], ["webfont.DomHelper","webfont.EventDispatcher","webfont.FontWatcher","webfont.FontModuleLoader"]); goog.addDependency("../../src/modules/custom.js", ["webfont.modules.Custom"], ["webfont.Font", "webfont.StyleSheetWaiter"]); -goog.addDependency("../../src/modules/fontdeck.js", ["webfont.modules.Fontdeck"], ["webfont.Font"]); goog.addDependency("../../src/modules/google/fontapiparser.js", ["webfont.modules.google.FontApiParser"], ["webfont.Font"]); goog.addDependency("../../src/modules/google/fontapiurlbuilder.js", ["webfont.modules.google.FontApiUrlBuilder"], []); goog.addDependency("../../src/modules/google/googlefontapi.js", ["webfont.modules.google.GoogleFontApi"], ["webfont.modules.google.FontApiUrlBuilder","webfont.modules.google.FontApiParser","webfont.FontWatchRunner", "webfont.StyleSheetWaiter"]); diff --git a/spec/index.html b/spec/index.html index e0d7c618..6bca7772 100644 --- a/spec/index.html +++ b/spec/index.html @@ -43,7 +43,6 @@ - diff --git a/spec/modules/fontdeck_spec.js b/spec/modules/fontdeck_spec.js deleted file mode 100644 index 71861685..00000000 --- a/spec/modules/fontdeck_spec.js +++ /dev/null @@ -1,99 +0,0 @@ -describe('modules.Fontdeck', function () { - var Fontdeck = webfont.modules.Fontdeck, - Font = webfont.Font; - - var configuration = { - id: '2282' - }; - - var apiResponse = { - "domain" : "localhost", - "cssurl" : "https://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs/localhost/2282.css", - "project" : 2282, - "cssbase" : "https://f.fontdeck.com/s/css/03BmCXiV2AHwX/Rp+OBFTfD2oFs", - "fonts" : [ - { - "font_family" : "'Fertigo Pro Regular', Fertigo, Constantia, Palatino, serif", - "font_size_adjust" : 0.508, - "name" : "Fertigo Pro Regular", - "style" : "normal", - "weight" : "normal", - "font_urls" : { - "eot" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.eot", - "ttf" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.ttf", - "woff" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.woff", - "svg" : "https://f.fontdeck.com/f/1/SUlFR0tid0kAA2vb11Ly/IGWDK+wV8TMAfV0J1Ej1J1GFRT1bssqrn6a.svg#104" - }, - "id" : 104 - }, - { - "font_family" : "'Bodoni Display Bold Italic', Georgia, 'Times New Roman', Times, serif", - "font_size_adjust" : 0.45, - "name" : "Bodoni Display Bold Italic", - "style" : "italic", - "weight" : "bold", - "font_urls" : { - "eot" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.eot", - "ttf" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.ttf", - "woff" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.woff", - "svg" : "https://f.fontdeck.com/f/1/azJEbTVyc1QAA11+CAE5C93+l/bAQx1ipRo6Maba19w3Yy5ng+qVWlfj.svg#2256" - }, - "id" : 2256 - } - ] - }; - - var fakeDomHelper = null, - global = null; - - beforeEach(function () { - global = { - location: {} - }; - - fakeDomHelper = { - loadScript: jasmine.createSpy('loadScript'), - getLoadWindow: jasmine.createSpy('getLoadWindow').andReturn(global), - getHostName: function () { return 'test-host-name'; } - }; - }); - - describe('support and load life cycle', function () { - var fontdeck = null, - onReady = jasmine.createSpy('onReady'); - - beforeEach(function () { - fontdeck = new Fontdeck(fakeDomHelper, configuration); - fontdeck.load(onReady); - }); - - it('should create the script correctly', function () { - expect(fakeDomHelper.loadScript).toHaveBeenCalled(); - expect(fakeDomHelper.loadScript.calls[0].args[0]).toEqual('https://f.fontdeck.com/s/css/js/test-host-name/2282.js'); - }); - - it('should have created a global', function () { - expect(global.__webfontfontdeckmodule__).not.toBeNull(); - expect(global.__webfontfontdeckmodule__['2282']).not.toBeNull(); - }); - - it('should load correctly after calling the callback', function () { - global.__webfontfontdeckmodule__['2282'](true, apiResponse); - - expect(fontdeck.fonts_).toEqual([new Font(apiResponse.fonts[0].name), new Font(apiResponse.fonts[1].name, 'i7')]); - }); - }); - - describe('no project id', function () { - var fontdeck = null, - support = null; - - beforeEach(function () { - fontdeck = new Fontdeck(fakeDomHelper, { id: null }); - }); - - it('should not have loaded any fonts', function () { - expect(fontdeck.fonts_).toEqual([]); - }); - }); -}); diff --git a/src/core/initialize.js b/src/core/initialize.js index 94231e5a..2d66d48d 100644 --- a/src/core/initialize.js +++ b/src/core/initialize.js @@ -3,7 +3,6 @@ goog.provide('webfont'); goog.require('webfont.WebFont'); goog.require('webfont.modules.Typekit'); -goog.require('webfont.modules.Fontdeck'); goog.require('webfont.modules.Monotype'); goog.require('webfont.modules.Custom'); goog.require('webfont.modules.google.GoogleFontApi'); @@ -13,11 +12,6 @@ goog.require('webfont.modules.google.GoogleFontApi'); */ var INCLUDE_CUSTOM_MODULE = false; -/** - * @define {boolean} - */ -var INCLUDE_FONTDECK_MODULE = false; - /** * @define {boolean} */ @@ -54,12 +48,6 @@ if (INCLUDE_CUSTOM_MODULE) { }); } -if (INCLUDE_FONTDECK_MODULE) { - webFontLoader.addModule(webfont.modules.Fontdeck.NAME, function (configuration, domHelper) { - return new webfont.modules.Fontdeck(domHelper, configuration); - }); -} - if (INCLUDE_MONOTYPE_MODULE) { webFontLoader.addModule(webfont.modules.Monotype.NAME, function (configuration, domHelper) { return new webfont.modules.Monotype(domHelper, configuration); diff --git a/src/modules.yml b/src/modules.yml index 6186bc48..04ff5780 100644 --- a/src/modules.yml +++ b/src/modules.yml @@ -21,9 +21,6 @@ google: - modules/google/fontapiparser.js - modules/google/googlefontapi.js -fontdeck: - - modules/fontdeck.js - typekit: - modules/typekit.js diff --git a/src/modules/fontdeck.js b/src/modules/fontdeck.js deleted file mode 100644 index a195b325..00000000 --- a/src/modules/fontdeck.js +++ /dev/null @@ -1,66 +0,0 @@ -goog.provide('webfont.modules.Fontdeck'); - -goog.require('webfont.Font'); - -/** - * @constructor - * @implements {webfont.FontModule} - */ -webfont.modules.Fontdeck = function(domHelper, configuration) { - this.domHelper_ = domHelper; - this.configuration_ = configuration; - this.fonts_ = []; -}; - -/** - * @const - * @type {string} - */ -webfont.modules.Fontdeck.NAME = 'fontdeck'; -webfont.modules.Fontdeck.HOOK = '__webfontfontdeckmodule__'; -webfont.modules.Fontdeck.API = 'https://f.fontdeck.com/s/css/js/'; - -goog.scope(function () { - var Fontdeck = webfont.modules.Fontdeck, - Font = webfont.Font, - FontVariationDescription = webfont.FontVariationDescription; - - Fontdeck.prototype.getScriptSrc = function(projectId) { - // For empty iframes, fall back to main window's hostname. - var hostname = this.domHelper_.getHostName(); - var api = this.configuration_['api'] || webfont.modules.Fontdeck.API; - return api + hostname + '/' + projectId + '.js'; - }; - - Fontdeck.prototype.load = function(onReady) { - var projectId = this.configuration_['id']; - var loadWindow = this.domHelper_.getLoadWindow(); - var self = this; - - if (projectId) { - // Provide data to Fontdeck for processing. - if (!loadWindow[webfont.modules.Fontdeck.HOOK]) { - loadWindow[webfont.modules.Fontdeck.HOOK] = {}; - } - - // Fontdeck will call this function to indicate support status - // and what fonts are provided. - loadWindow[webfont.modules.Fontdeck.HOOK][projectId] = function(fontdeckSupports, data) { - for (var i = 0, j = data['fonts'].length; i