Giter Club home page Giter Club logo

glyphs.geolonia.com's Introduction

glyphs.geolonia.com

このサーバーは、Mapbox GL JS で日本語を表示するためのフォントサーバーです。

style.jsonglyphs の値に以下の URL を指定することで利用可能です。

https://glyphs.geolonia.com/{fontstack}/{range}.pbf

ドキュメント: https://www.mapbox.com/mapbox-gl-js/style-spec/#root-glyphs

フォントについて

このサーバーでは以下のフォントを提供しています。

  • Noto Sans CJK JP Bold
  • Noto Sans CJK JP Light
  • Noto Sans CJK JP Regular
  • Noto Sans Regular

style.jsontext-font: ['Noto Sans CJK JP Regular'] のようにご利用ください。

  • 便宜上の問題により、Noto Sans RegularNoto Sans CJK JP Regular のエイリアスで、日本語のフォントも含まれます。
  • 本サーバーはスタティックなホスティングのため ['Noto Sans CJK JP Regular', 'Noto Sans CJK JP Light'] のように複数指定された場合には、404 のエラーを返します。

Mapbox GL JS における日本語の表示について

現実的には、mapboxgl.Map() で以下のように指定することで、日本語が含まれないフォントを指定しても日本語が表示されます。

const map = new mapboxgl.Map({
  container: 'map',
  style: './style.json',
  attributionControl: true,
  hash: true,
  localIdeographFontFamily: ['sans-serif'] // 日本語を表示するための設定
});

この方法は、日本語フォントをダウンロードしないため、表示速度がはやくなりますので、この設定を入れておくことをおすすめします。 ただし、Maputnik でスタイルのカスタマイズをする際に、Maputnikに上述の設定が入っていないため日本語が表示されません。

したがって、念の為程度にこのサイトで提供している日本語フォントを設定しておくと良いかもしれません。

ビルド

$ npm install
$ npm run build-font # フォントをビルド
$ npm run build-html # HTML ページをビルド

プルリクエストや Issue はいつでも歓迎します。

https://github.com/geolonia/glyphs.geolonia.com

免責事項

  • 本サーバーは、日本における Mapbox GL JS の開発コミュニティの皆さんのお役に立つために、無償でだれでもご利用可能とさせていただきますが、予告なくサービスを停止させていただくこともございますのであらかじめご了承ください。

ライセンス

  • このリポジトリで使用されているフォントは、Google の Noto Fonts で、SIL Open Font License 1.1 によって提供されています。
  • フォント以外のソースコードは MIT ライセンスとします。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.