Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[demo] use Oswald web font on shields #955

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shieldlib/src/screen_gfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import rgba from "color-rgba";

const defaultFontFamily = '"sans-serif-condensed", "Arial Narrow", sans-serif';
export const shieldFont = (size: number, fontFamily: string) =>
`bold ${size}px ${fontFamily || defaultFontFamily}`;
`500 ${size}px ${fontFamily || defaultFontFamily}`;
export const fontSizeThreshold = 12;

// Replaces `sourceVal` with a blend of `lightenVal` and `darkenVal` proportional to the brightness;
Expand Down
9 changes: 9 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<head>
<meta charset="utf-8" />
<title>OpenStreetMap Americana</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<meta
name="viewport"
Expand Down Expand Up @@ -96,6 +102,9 @@
</head>

<body>
<p style="font-family: Oswald; font-weight:500; visibility: hidden">
Invisible text so the font will load early
</p>
<div id="map"></div>
<div id="attribution-logo"></div>
<a href="https://github.com/ZeLonewolf/openstreetmap-americana/"
Expand Down
2 changes: 1 addition & 1 deletion src/js/shield_defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3753,7 +3753,7 @@ export function loadShields() {
bannerTextHaloColor: Color.backgroundFill,
bannerHeight: 9,
bannerPadding: 1,
shieldFont: '"sans-serif-condensed", "Arial Narrow", sans-serif',
shieldFont: 'Oswald, "sans-serif-condensed", "Arial Narrow", sans-serif',
shieldSize: 20,
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/shieldtest.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Overpass:wght@500&display=block"
href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=block"
rel="stylesheet"
/>
<style>
Expand Down Expand Up @@ -47,7 +47,7 @@
</thead>
</table>

<p style="font-family: Overpass; visibility: hidden">
<p style="font-family: Oswald; font-weight:500; visibility: hidden">
Invisible text so the font will load early
</p>
<div id="map" style="display: none"></div>
Expand Down