-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added enableFontFaces and removed FontFacesProvider
BREAKING CHANGE: `FontFacesProvider` was removed in favor of `enableFontFaces` Closes #47
- Loading branch information
Kyler Jensen
committed
Aug 21, 2020
1 parent
00ee111
commit ede1cfc
Showing
32 changed files
with
306 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { DynamicFontListEntry } from './DynamicFontListEntry'; | ||
|
||
export type DynamicFontList = DynamicFontListEntry[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type DynamicFontListEntry = { | ||
name: string; | ||
data: string; | ||
type?: 'ttf' | 'otf'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { ExpoFontMapEntry } from './ExpoFontMapEntry'; | ||
|
||
export type ExpoFontMap = { [key: string]: ExpoFontMapEntry }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type ExpoFontMapEntry = string | number | { uri: string | number }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { FontFace } from '../types/FontFace'; | ||
import { getExpoFontMap } from './getExpoFontMap'; | ||
import { overrideTextRenderFn } from './overrideTextRenderFn'; | ||
import { registerGlobalFontFaces } from './registerGlobalFontFaces'; | ||
import { overrideTextInputRenderFn } from './overrideTextInputRenderFn'; | ||
import { getDynamicFontList } from './getDynamicFontList'; | ||
|
||
export function enableFontFaces(fontFaces: FontFace[]) { | ||
overrideTextRenderFn(); | ||
overrideTextInputRenderFn(); | ||
registerGlobalFontFaces(fontFaces); | ||
return { | ||
expo: getExpoFontMap(fontFaces), | ||
rndf: getDynamicFontList(fontFaces), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { FontFace } from '../types/FontFace'; | ||
import { generateInlineStyleSheet } from './generateInlineStyleSheet'; | ||
|
||
export function enableFontFaces(fontFaces: FontFace[]): Record<string, string> { | ||
const style = document.createElement('style'); | ||
style.innerHTML = generateInlineStyleSheet(fontFaces); | ||
document.head.append(style); | ||
return {}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.