This question is way too broad for a complete answer in a Q&A format, but here is roughly what I would do:
- Collect all system fonts in an array
$sys_fonts
- Collect all Google fonts in an array
$ggl_fonts
- Collect the complete info about Google fonts in a multidimensional array
$ggl_fontinfo
- Merge
$sys_fonts
and$ggl_fonts
in an array$total_fonts
- Use
$total_fonts
for your dropdown - Using jquery, detect which item is selected from the dropdown
- If the item is in
sys_fonts
use the normal procedure to change the css without reloading the page. - If the item is in
ggl_fonts
use it as a key to look up variants (bold, italics, etc) and subsets (languages) inggl_fontinfo
. Then, dynamically add fields to the form. Once all is set, look up which font files you need inggl_fontinfo
and load them dynamically into the page.
Beware that depending on your skills this may take several days to implement (which is why you are unlikely to get a cut-and-paste-ready answer here for free)