Skip to content

Commit de820e1

Browse files
authored
Remove Twemoji SBIX font in favour of COLRv0 (element-hq#28549)
* Remove Twemoji SBIX font in favour of COLRv0 as it is supported everywhere we need it Signed-off-by: Michael Telatynski <[email protected]> * Remove unused mock Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent 0333cba commit de820e1

File tree

7 files changed

+18
-140
lines changed

7 files changed

+18
-140
lines changed

Diff for: __mocks__/FontManager.js

-6
This file was deleted.

Diff for: jest.config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const config: Config = {
3232
"decoderWorker\\.min\\.wasm": "<rootDir>/__mocks__/empty.js",
3333
"waveWorker\\.min\\.js": "<rootDir>/__mocks__/empty.js",
3434
"context-filter-polyfill": "<rootDir>/__mocks__/empty.js",
35-
"FontManager.ts": "<rootDir>/__mocks__/FontManager.js",
3635
"workers/(.+)Factory": "<rootDir>/__mocks__/workerFactoryMock.js",
3736
"^!!raw-loader!.*": "jest-raw-loader",
3837
"recorderWorkletFactory": "<rootDir>/__mocks__/empty.js",

Diff for: res/fonts/Twemoji_Mozilla/TwemojiMozilla-sbix.woff2

-2.77 MB
Binary file not shown.

Diff for: res/themes/light/css/_fonts.pcss

+18
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,21 @@ $inter-unicode-range: U+0000-20e2, U+20e4-23ce, U+23d0-24c1, U+24c3-259f, U+25c2
143143
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC,
144144
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
145145
}
146+
147+
/* Twemoji COLR */
148+
@font-face {
149+
font-family: "Twemoji";
150+
font-weight: 400;
151+
src: url("$(res)/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2") format("woff2");
152+
}
153+
/* For at least Chrome on Windows 10, we have to explictly add extra weights for the emoji to appear in bold messages, etc. */
154+
@font-face {
155+
font-family: "Twemoji";
156+
font-weight: 600;
157+
src: url("$(res)/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2") format("woff2");
158+
}
159+
@font-face {
160+
font-family: "Twemoji";
161+
font-weight: 700;
162+
src: url("$(res)/fonts/Twemoji_Mozilla/TwemojiMozilla-colr.woff2") format("woff2");
163+
}

Diff for: src/components/structures/LoggedInView.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import classNames from "classnames";
2323
import { isOnlyCtrlOrCmdKeyEvent, Key } from "../../Keyboard";
2424
import PageTypes from "../../PageTypes";
2525
import MediaDeviceHandler from "../../MediaDeviceHandler";
26-
import { fixupColorFonts } from "../../utils/FontManager";
2726
import dis from "../../dispatcher/dispatcher";
2827
import { IMatrixClientCreds } from "../../MatrixClientPeg";
2928
import SettingsStore from "../../settings/SettingsStore";
@@ -149,8 +148,6 @@ class LoggedInView extends React.Component<IProps, IState> {
149148

150149
MediaDeviceHandler.loadDevices();
151150

152-
fixupColorFonts();
153-
154151
this._roomView = React.createRef();
155152
this._resizeContainer = React.createRef();
156153
this.resizeHandler = React.createRef();

Diff for: src/components/views/verification/VerificationShowSas.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import SasEmoji from "@matrix-org/spec/sas-emoji.json";
1414
import { _t, getNormalizedLanguageKeys, getUserLanguage } from "../../../languageHandler";
1515
import { PendingActionSpinner } from "../right_panel/EncryptionInfo";
1616
import AccessibleButton from "../elements/AccessibleButton";
17-
import { fixupColorFonts } from "../../../utils/FontManager";
1817

1918
interface IProps {
2019
pending?: boolean;
@@ -88,11 +87,6 @@ export default class VerificationShowSas extends React.Component<IProps, IState>
8887
this.state = {
8988
pending: false,
9089
};
91-
92-
// As this component is also used before login (during complete security),
93-
// also make sure we have a working emoji font to display the SAS emojis here.
94-
// This is also done from LoggedInView.
95-
fixupColorFonts();
9690
}
9791

9892
private onMatchClick = (): void => {

Diff for: src/utils/FontManager.ts

-124
This file was deleted.

0 commit comments

Comments
 (0)