|開発環境|Microsoft Visual Studio Community 2017| |実行環境|Windows 10 Home (64bit)| |プロジェクトの種類|Visual C++/空のプロジェクト| |プロジェクト名|fontglyph| fontglyph.cpp #highlight(cpp){{ // Unicode文字セット #include <Windows.h> #include <fcntl.h> #include <io.h> #include <stdio.h> #include <set> #include <string> using namespace std; typedef set<wstring> SFN; SFN sfn; int CALLBACK EnumFontFamExProc(const LOGFONT *lpelfe, const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam) { if (sfn.find(lpelfe->lfFaceName) == sfn.end()) { sfn.insert(lpelfe->lfFaceName); } return 1; } int wmain() { _setmode(_fileno(stdout), _O_U8TEXT); HDC hdc = GetDC(NULL); LOGFONT lf = { 0 }; lf.lfCharSet = DEFAULT_CHARSET; EnumFontFamiliesEx(hdc, &lf, EnumFontFamExProc, 0, 0); for (auto& it : sfn) { LOGFONT lf = { 0 }; lf.lfCharSet = DEFAULT_CHARSET; lf.lfHeight = 16; wcscpy_s(lf.lfFaceName, it.c_str()); HFONT hFont = CreateFontIndirect(&lf); HGDIOBJ hFontOld = SelectObject(hdc, hFont); WORD gi[8] = { 0 }; DWORD dw = GetGlyphIndices(hdc, L"\uFDFD", 1, gi, GGI_MARK_NONEXISTING_GLYPHS); if (gi[0] != 0xffff) { wprintf(L"%s\n", it.c_str()); } SelectObject(hdc, hFontOld); DeleteObject(hFont); } ReleaseDC(NULL, hdc); return 0; } }} 実行例 #highlight(txt){{ Amiri Amiri Quran Arial Calibri Calibri Light Microsoft Sans Serif Noto Naskh Arabic Noto Naskh Arabic UI Noto Sans Arabic Noto Sans Arabic UI Segoe UI Segoe UI Light Segoe UI Semibold Segoe UI Semilight Tahoma Times New Roman }} [[(U+FDFD)のあるフォント一覧>http://www.maroon.dti.ne.jp/lance/js/charcode/font_fdfd.html]]