Skip to content

Commit

Permalink
0.17.6-10, 2.6.3-beta-2 (removed font load safari)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed Nov 1, 2024
1 parent a02fff6 commit 8b0c2ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/excalidraw/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3416,11 +3416,11 @@ class App extends React.Component<AppProps, AppState> {
});

// paste event may not fire FontFace loadingdone event in Safari, hence loading font faces manually
if (isSafari) {
/*if (isSafari) {
Fonts.loadElementsFonts(newElements).then((fontFaces) => {
this.fonts.onLoaded(fontFaces);
});
}
}*/ //zsviczian - this might need testing on Ovsidian iPad, otherwise Obsidian is never on safari

if (opts.files) {
this.addMissingFiles(opts.files);
Expand Down
8 changes: 5 additions & 3 deletions packages/excalidraw/fonts/Fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import type {
import type Scene from "../scene/Scene";
import type { ValueOf } from "../utility-types";

const NEVERSAFARI = false; //zsviczian

export class Fonts {
// it's ok to track fonts across multiple instances only once, so let's use
// a static member to reduce memory footprint
Expand Down Expand Up @@ -148,7 +150,7 @@ export class Fonts {
*/
public loadSceneFonts = async (): Promise<FontFace[]> => {
const sceneFamilies = this.getSceneFamilies();
const charsPerFamily = isSafari
const charsPerFamily = NEVERSAFARI //zsviczian
? Fonts.getCharsPerFamily(this.scene.getNonDeletedElements())
: undefined;

Expand All @@ -166,7 +168,7 @@ export class Fonts {
elements: readonly ExcalidrawElement[],
): Promise<FontFace[]> => {
const fontFamilies = Fonts.getUniqueFamilies(elements);
const charsPerFamily = isSafari
const charsPerFamily = NEVERSAFARI //zsviczian
? Fonts.getCharsPerFamily(elements)
: undefined;

Expand Down Expand Up @@ -263,7 +265,7 @@ export class Fonts {
// WARN: without "text" param it does not have to mean that all font faces are loaded, instead it could be just one!
// for Safari on init, we rather check with the "text" param, even though it's less efficient, as otherwise fonts might remain unloaded
const text =
isSafari && charsPerFamily
NEVERSAFARI && charsPerFamily //zsviczian
? Fonts.getCharacters(charsPerFamily, fontFamily)
: "";

Expand Down
2 changes: 1 addition & 1 deletion packages/excalidraw/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zsviczian/excalidraw",
"version": "0.17.6-9",
"version": "0.17.6-10",
"main": "main.js",
"types": "types/excalidraw/index.d.ts",
"files": [
Expand Down

0 comments on commit 8b0c2ad

Please sign in to comment.