Skip to content

Commit

Permalink
Merge pull request #619 from tomusborne/tweak/use-font-family-value
Browse files Browse the repository at this point in the history
Tweak: Use GP Font Library font family value
  • Loading branch information
tomusborne committed Jul 2, 2024
2 parents 0f65f76 + eda7a89 commit c38f422
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inc/customizer/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ function generate_do_control_inline_scripts() {
'showGoogleFonts' => apply_filters( 'generate_font_manager_show_google_fonts', true ),
'colorPickerShouldShift' => function_exists( 'did_filter' ),
'gpFontLibrary' => class_exists( 'GeneratePress_Font_Library' )
? GeneratePress_Font_Library::get_font_families()
? GeneratePress_Font_Library::get_fonts()
: array(),
'gpFontLibraryURI' => class_exists( 'GeneratePress_Font_Library' )
? GeneratePress_Font_Library::get_font_library_uri()
Expand Down
10 changes: 8 additions & 2 deletions src/customizer-controls/font-manager/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,16 @@ const getFontFamilies = () => {

if ( gpFontLibrary && gpFontLibrary.length > 0 ) {
gpFontLibrary.forEach( ( font ) => {
const fontName = font.alias ? font.alias : font.name;
const fontFamily = font.fontFamily ? font.fontFamily : fontName;
const value = font.cssVariable
? `var(${ font.cssVariable })`
: fontFamily;

fontFamilies.push(
{
value: font.name,
label: font.name,
value,
label: fontName,
}
);
} );
Expand Down

0 comments on commit c38f422

Please sign in to comment.