當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript webfontloader.load函數代碼示例

本文整理匯總了TypeScript中webfontloader.load函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript load函數的具體用法?TypeScript load怎麽用?TypeScript load使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了load函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Promise

 return new Promise(function(resolve, reject) {
   load({
     google: {
       families: ['Lato', 'Montserrat']
     },
     active: resolve,
     inactive: reject
   })
 })
開發者ID:MikaAK,項目名稱:trello-burndown,代碼行數:9,代碼來源:index.ts

示例2:

window.onload = () => {
  WebFont.load({
    google: {
      families: [fontFamily]
    },
    active: init,
    inactive: init,
    timeout: 2000
  });
};
開發者ID:abagames,項目名稱:pixel-art-gen,代碼行數:10,代碼來源:recoil.ts

示例3: main

export function main() {
  // Load fonts async
  // https://github.com/typekit/webfontloader#configuration
  loadWebFont({
    google: {
      families: ['Droid Sans']
    }
  });

  return platformRef.bootstrapModuleFactory(MainModuleNgFactory);
}
開發者ID:Hongbo-Miao,項目名稱:universal-starter,代碼行數:11,代碼來源:client.aot.ts

示例4: loadThemeFonts

export function loadThemeFonts() {
    const state = getDeferredStoreState<ICoreStoreState, null>(null);
    if (state !== null) {
        const assets = state.theme.assets.data || {};
        const { fonts } = assets;

        if (fonts) {
            const webFontConfig: WebFont.Config = {
                custom: {
                    families: fonts.map(font => font.name),
                    urls: fonts.map(font => font.url),
                },
            };

            if (webFontConfig.custom && webFontConfig.custom.urls && webFontConfig.custom.urls.length > 0) {
                WebFont.load(webFontConfig);
            }
        } else {
            // If the theme has no font config of its own, load the default.
            WebFont.load(defaultFontConfig);
        }
    }
}
開發者ID:vanilla,項目名稱:vanilla,代碼行數:23,代碼來源:loadThemeFonts.ts

示例5: preload

  preload () {
    WebFont.load({
      google: {
        families: ['Nunito']
      },
      active: this.fontsLoaded
    })

    let text = this.add.text(this.world.centerX, this.world.centerY, 'loading fonts', { font: '16px Arial', fill: '#dddddd', align: 'center' })
    text.anchor.setTo(0.5, 0.5)

    this.load.image('loaderBg', './assets/images/loader-bg.png')
    this.load.image('loaderBar', './assets/images/loader-bar.png')
  }
開發者ID:mgiambalvo,項目名稱:phaser-typescript-webpack-starter,代碼行數:14,代碼來源:boot.ts

示例6: start

function start() {
    WebFont.load({
        custom: {
            families: ['moonhouseregular'],
            urls: ['assets/fonts.css']
        }
    });

    (document.querySelector(".overlay") as any).style.display = "none";
    let game = new Phaser.Game(800, 600, Phaser.AUTO);
    game.state.add("boot", Boot);
    game.state.add("loader", Loader);
    game.state.add("game", Phase1);
    game.state.start("boot");
}
開發者ID:monagames,項目名稱:spacemonas,代碼行數:15,代碼來源:main.ts

示例7: startApp

window.onload = () => {
    let webFontLoaderOptions: any = null;
    let webFontsToLoad: string[] = GOOGLE_WEB_FONTS;

    if (webFontsToLoad.length > 0) {
        webFontLoaderOptions = (webFontLoaderOptions || {});

        webFontLoaderOptions.google = {
            families: webFontsToLoad
        };
    }

    if (Object.keys(Assets.CustomWebFonts).length > 0) {
        webFontLoaderOptions = (webFontLoaderOptions || {});

        webFontLoaderOptions.custom = {
            families: [],
            urls: []
        };

        for (let font in Assets.CustomWebFonts) {
            webFontLoaderOptions.custom.families.push(Assets.CustomWebFonts[font].getFamily());
            webFontLoaderOptions.custom.urls.push(Assets.CustomWebFonts[font].getCSS());
        }
    }

    if (webFontLoaderOptions === null) {
        // Just start the game, we don't need any additional fonts
        startApp();
    } else {
        // Load the fonts defined in webFontsToLoad from Google Web Fonts, and/or any Local Fonts then start the game knowing the fonts are available
        webFontLoaderOptions.active = startApp;

        WebFontLoader.load(webFontLoaderOptions);
    }
};
開發者ID:PLyn,項目名稱:PhaserTypescriptStarterTemplate,代碼行數:36,代碼來源:app.ts

示例8: load

import * as path from "path";
import { load } from "webfontloader";

const fontFolder = ["..", "node_modules", "nteract-assets", "fonts"];

load({
  custom: {
    families: ["Source Sans Pro", "Source Code Pro"],
    urls: [
      path.join(...fontFolder, "source-sans-pro", "source-sans-pro.css"),
      path.join(...fontFolder, "source-code-pro", "source-code-pro.css")
    ]
  }
});
開發者ID:nteract,項目名稱:nteract,代碼行數:14,代碼來源:fonts.ts

示例9: load

// TODO: There is the potential to have a Flash-of-Unstyled-Content since this is
//       now async
import { load } from "webfontloader";

load({
  google: {
    families: ["Source Sans Pro", "Source Serif Pro", "Source Code Pro"]
  }
});
開發者ID:nteract,項目名稱:nteract,代碼行數:9,代碼來源:fonts.ts

示例10: require

import 'reflect-metadata';
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import 'ts-helpers';

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { QtAppModule } from './app.module';

const WebFont = require('webfontloader');

WebFont.load({
  google: {
    families: [
      'Roboto:400,500,700',
      'Playfair+Display:400,700',
      'Material+Icons',
    ],
  },
});

if (__PRODUCTION__) {
  enableProdMode();
} else {
  require('zone.js/dist/long-stack-trace-zone');
}

platformBrowserDynamic().bootstrapModule(QtAppModule);
開發者ID:rtbm,項目名稱:ng2-quottr,代碼行數:29,代碼來源:boot.ts


注:本文中的webfontloader.load函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。