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

nameWidthfunction

About how wide a name is, in pixels, without reading any layout: a Japanese character is as wide as the text is tall, any other about 0.58 of it.

Import it

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

Definition

function nameWidth(text: string, size: number): number

Parameters

NameTypeDescription
textstring

The name.

sizenumber

The text size in pixels.

Returns

number

The width, in pixels.

Examples

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

console.log(nameWidth("Tokyo", 12), nameWidth("東京", 12));
39 28

What it prints (run when this page was built)

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