-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM: Updating core Noto Sans fonts and adding new CJK fonts #36962
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. |
… notifications if an install fails
$large_font_files = array( 'NotoSansSimplifiedChinese.zip', 'NotoSerifDisplay.zip', 'NotoSans.zip', 'NotoSansDisplay.zip', 'NotoSansTaiwan.zip', 'NotoSansHongKong.zip', 'NotoSansJapanese.zip', 'NooSansKorean.zip', 'NotoSansMono.zip' ); | ||
// Several large font files may timeout when downloading. Increase the timeout for these files. | ||
foreach ( $large_font_files as $file ) { | ||
if ( str_ends_with( $url, $file ) ) { | ||
|
||
add_filter( 'http_request_timeout', 'custom_large_font_timeout' ); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works. Did you consider moving this into retrieve_and_install_specific_font()
, though? I think it'd work better here:
if ( !zeroBSCRM_retrieveFile( $zbs->urls['extdlfonts'] . $remote_zip_name, $temp_path ) ) { |
This would mean you no longer need str_ends_with()
(or even a loop), as you have the actual filename already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not consider that, I made an assumption the timeout filter needed to be in the same function but I can see it doesn't! Thank you.
/** | ||
* Increase the timeout for large font files. | ||
* The timeout is increased to 60 seconds (the default is 5), for large font files. | ||
* @return int The timeout in seconds. | ||
*/ | ||
function custom_large_font_timeout() { | ||
return 60; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the above comment, I'd move this into the jpcrm-fonts.php
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this works, and it's a huge deal! Great job!
I've left a few small comments. One other thing to consider is how the new CJK fonts show in the dropdown. Right now Japanese makes sense, but "Hong Kong", and "Taiwan" aren't scripts. I'd recommend instead doing something like:
- Chinese (Traditional, Hong Kong)
- Chinese (Traditional, Taiwan)
- Chinese (Simplified)
It looks like there's a cleaned_alphabetical
section of list_all_available()
that supports display manipulation already.
Co-authored-by: tbradsha <[email protected]>
…c_font, with easier font name checks.
@@ -380,7 +380,7 @@ | |||
sprintf( | |||
/* translators: %s is the URL of the CRM support doc explaining how to add styles to pdf templates. */ | |||
__( 'Once a new font is installed, <a href="%s" target="_blank">learn more about using the custom fonts in CRM PDFs here</a>.', 'zero-bs-crm' ), | |||
esc_url( 'https://kb.jetpackcrm.com/knowledge-base/using-custom-fonts-in-crm-pdfs-e-g-invoice-templates' ) | |||
esc_url( $zbs->urls['kb-pdf-custom-fonts'] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
Thanks!
Yes, you're right. I unnecessarily modified the file names (zip names, etc) to make the display more readable, but I think that is ok to leave them now that they are changed. Only one thing I've spotted isn't working ideally - the new support doc link isn't opening in a new tab for me. I am not seeing what is causing this just now, so may need to come back to this. |
Note that I was getting PHP notices when installing some of the CJK fonts due to certain variants not being present:
Resolved in 9be0b73 by flipping the |
This is less important in my opinion, though, as at least they can now easily discover the font to add.
Looks like |
… that in the @params in function comment
…s-plus-update-core
Fixes https://github.com/Automattic/zero-bs-crm/issues/1782
Proposed changes:
$font_json
variable with the five new CJK fonts:pdffonts.zip
file with new core Noto Sans font versions, which apart from updating several-year-old files also means that the two new currencies added in this PR will be viewable on PDF as well: CRM: Add several new currencies to the CRM currency dropdown #36897Other information:
Jetpack product discussion
https://github.com/Automattic/zero-bs-crm/issues/1782
p1713366111446779-slack-CTXBP902X
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
wp-admin/admin.php?page=zerobscrm-plugin-settings&tab=locale
- set your currency to be the Azerbaijan Manat ('₼', 'AZN'), or the Kazakhstani Tenge ('₸', 'KZT').