Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The realistic Earth's pure parts

countryNameBoxfunction

About how wide and tall a country's name is, in pixels, without reading any layout: a Japanese character as wide as the text is tall, a capital about 0.7 of it, with the letters' spacing.

Import it

import { countryNameBox } from "@johnmorrisdotca/chikyu-earth/realistic";

Definition

function countryNameBox(text: string, size: number): { width: number; height: number; }

Parameters

NameTypeDescription
textstring

The name.

sizenumber

The text size in pixels.

Returns

{ width: number; height: number; }

The width and height.

Examples

import { countryNameBox } from "@johnmorrisdotca/chikyu-earth/realistic";

console.log(countryNameBox("JAPAN", 12), countryNameBox("日本", 12));
{ width: 50, height: 16 } { width: 30, height: 16 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.