Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(subtitles): position part1

Hristo Terezov6c6ed8d7a8f7
diff --git a/react/features/base/ui/functions.any.ts b/react/features/base/ui/functions.any.ts
new file mode 100644
index 0000000000..8bef961a1d
--- /dev/null
+++ b/react/features/base/ui/functions.any.ts
@@ -0,0 +1,14 @@
+// Base font size in pixels (standard is 16px = 1rem)
+const BASE_FONT_SIZE = 16;
+
+/**
+ * Converts rem to pixels.
+ *
+ * @param {string} remValue - The value in rem units (e.g. '0.875rem').
+ * @returns {number}
+ */
+export function remToPixels(remValue: string): number {
+ const numericValue = parseFloat(remValue.replace('rem', ''));
+
+ return Math.round(numericValue * BASE_FONT_SIZE);
+}
diff --git a/react/features/base/ui/functions.native.ts b/react/features/base/ui/functions.native.ts
index 31ddffa584..780c101ed8 100644
--- a/react/features/base/ui/functions.native.ts
+++ b/react/features/base/ui/functions.native.ts
@@ -1,21 +1,9 @@
import { DefaultTheme } from 'react-native-paper';
import { createColorTokens } from './utils';
+import { remToPixels } from './functions.any';
-// Base font size in pixels (standard is 16px = 1rem)
-const BASE_FONT_SIZE = 16;
-
-/**
- * Converts rem to pixels.
- *
- * @param {string} remValue - The value in rem units (e.g. '0.875rem').
- * @returns {number}
- */
-function remToPixels(remValue: string): number {
- const numericValue = parseFloat(remValue.replace('rem', ''));
-
- return Math.round(numericValue * BASE_FONT_SIZE);
-}
+export * from './functions.any';
/**
* Converts all rem to pixels in an object.
diff --git a/react/features/base/ui/functions.web.ts b/react/features/base/ui/functions.web.ts
index caf9974be9..cbe8fb51b3 100644
--- a/react/features/base/ui/functions.web.ts
+++ b/react/features/base/ui/functions.web.ts
@@ -5,6 +5,8 @@ import { ITypography, IPalette as Palette1 } from '../ui/types';
import { createColorTokens } from './utils';
+export * from './functions.any';
+
declare module '@mui/material/styles' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface Palette extends Palette1 {}
diff --git a/react/features/display-name/components/web/styles.ts b/react/features/display-name/components/web/styles.ts
index 734a4a2603..8b609e2458 100644
--- a/react/features/display-name/components/web/styles.ts
+++ b/react/features/display-name/components/web/styles.ts
@@ -1,4 +1,5 @@
import { Theme } from '@mui/material';
+import { remToPixels } from '../../../base/ui/functions.any';
/**
* The vertical padding for the display name.
@@ -36,8 +37,8 @@ export function getStageParticipantFontSizeRange(theme: Theme) {
*/
export function getStageParticipantLineHeightRange(theme: Theme) {
return {
- max: theme.typography.bodyShortRegularLarge.lineHeight,
- min: theme.typography.bodyShortRegularSmall.lineHeight
+ max: remToPixels(String(theme.typography.bodyShortRegularLarge.lineHeight)),
+ min: remToPixels(String(theme.typography.bodyShortRegularSmall.lineHeight))
};
}