Skip to content

Commit

Permalink
🧪 use different font for measuring Playfair text
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Jan 3, 2025
1 parent daf1174 commit e4e5a6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/@ourworldindata/components/src/TextWrap/TextWrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ interface TextWrapProps {
firstLineOffset?: number
separators?: string[]
rawHtml?: boolean

// for testing
font?: string
}

interface WrapLine {
Expand Down Expand Up @@ -155,6 +158,7 @@ export class TextWrap {
let nextBounds = Bounds.forText(text, {
fontSize,
fontWeight,
fontFamily: this.props.font as any,
})

// add offset to the first line if given
Expand Down
1 change: 1 addition & 0 deletions packages/@ourworldindata/grapher/src/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class Header<

const makeTitle = (fontSize: number): TextWrap =>
new TextWrap({
font: "avenir", // TODO: for testing
text: this.titleText,
maxWidth: this.maxWidth - this.logoWidth - logoPadding,
fontWeight: this.titleFontWeight,
Expand Down

0 comments on commit e4e5a6e

Please sign in to comment.