Add Arial AFM and modify fontmetric.h (issue #10) #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Johnson,
Thanks for creating this package. This is very useful for image outputting.
I'm Bill and I work in CRO as an application programmer. Now I'm also a co-author of reporter package.
I found that Arial font is useful for pharmaceutical company. However, even though libconfig package is installed, Arial font might not be in the system. That's why I create issue #10.
I have modified the package, please review it and consider if it's okay to be implemented.
As for the details about my approach, please see below information.
(1.) Create Arial AFM (Adobe Font Metric) file with FontForge app
(2.) Put the AFM files into the existed inst folder in devEMF package

Then add them into

afmPathDBinfontmetric.h:(3.) Modify code the let devEMF read the Arial AFM file
Though we put Arial AFM files into inst/, it still won’t read them because we have libfontconfig-dev in our system, but we don’t have Arial font, then we always get the warning message such like:
devEMF: your system substituted font family ' Helvetica' when you requested 'Arial'
I think that's because when libfontconfig exists, the package substituted the similar font from libfontconfig font metric information instead of loading the AFM files from inst/.
So I modify the code in

fontmetric.h. If the font is not in libfontconfig font metric, then it will import AFM file.Then because the algorithm to read AFM is based on hexadecimal, we need to add decimal for Arial AFM.

(4.) Read and output Arial successfully
You can run below code for testing.
It seems that Arial font is populated successfully.

We can see that the x-axis label (generated from devEMF) looks the same as the footer (generated from MSWord):
I also test other fonts to make sure the original functionality is good.
Because I see you don't create tests folder, I test the cases under table. If you want unit tests in the package, I can add them.
If you have any thoughts or comments, please let me know.
Best,
Bill