Skip to content

Instantly share code, notes, and snippets.

@codeeshop-oc
Created February 7, 2022 13:57
Show Gist options
  • Save codeeshop-oc/2304ae3d869e5130c51cffefe770a691 to your computer and use it in GitHub Desktop.
Save codeeshop-oc/2304ae3d869e5130c51cffefe770a691 to your computer and use it in GitHub Desktop.
Add custom font in Summernote
Include font style on your page. For example, I am adding the Roboto font family.
Single
<link href="https://fonts.googleapis.com/css?family=Roboto" / rel="stylesheet">
Multiple
<link async href="https://fonts.googleapis.com/css?family=Roboto|Nunito:300,400,400i,600,700&display=swap" rel="stylesheet">
$('#summernote').summernote({
fontNames: ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Helvetica', 'Impact', 'Tahoma', 'Times New Roman', 'Verdana', 'Roboto'],
fontNamesIgnoreCheck: ['Roboto']
});
Configure the new font name with default fonts. Should ignore to check the new font as it takes time to load.
$('.summertext').summernote('fontName', 'Roboto');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment