Skip to content

Commit

Permalink
Update useFont to have the same default size than matchFont (#1889)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Oct 2, 2023
1 parent d6b4a6a commit 2dfac22
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions package/src/skia/core/Font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ import type { SkTypefaceFontProvider } from "../types/Paragraph/TypefaceFontProv

import { useTypeface } from "./Typeface";

const defaultFontSize = 14;

/**
* Returns a Skia Font object
* */
export const useFont = (
font: DataSourceParam,
size?: number,
size = defaultFontSize,
onError?: (err: Error) => void
) => {
const typeface = useTypeface(font, onError);
return useMemo(() => {
if (typeface && size) {
if (typeface) {
return Skia.Font(typeface, size);
} else if (typeface && !size) {
return Skia.Font(typeface);
} else {
return null;
}
Expand Down Expand Up @@ -52,7 +52,7 @@ interface RNFontStyle {

const defaultFontStyle: RNFontStyle = {
fontFamily: "System",
fontSize: 14,
fontSize: defaultFontSize,
fontStyle: "normal",
fontWeight: "normal",
};
Expand Down

0 comments on commit 2dfac22

Please sign in to comment.