Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Aegisub
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Kubat
Aegisub
Validations
48922bf4
Valider
48922bf4
rédigé
Il y a 5 ans
par
odrling
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge branch 'master' of github.com:TypesettingTools/Aegisub
parents
9c5f7f24
d0bab121
Branches
Branches contenant la validation
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/font_file_lister_gdi.cpp
+45
-20
45 ajouts, 20 suppressions
src/font_file_lister_gdi.cpp
avec
45 ajouts
et
20 suppressions
src/font_file_lister_gdi.cpp
+
45
−
20
Voir le fichier @
48922bf4
...
@@ -28,6 +28,47 @@
...
@@ -28,6 +28,47 @@
#include
<unicode/utf16.h>
#include
<unicode/utf16.h>
#include
<Usp10.h>
#include
<Usp10.h>
static
void
read_fonts_from_key
(
HKEY
hkey
,
agi
::
fs
::
path
font_dir
,
std
::
vector
<
agi
::
fs
::
path
>
&
files
)
{
static
const
auto
fonts_key_name
=
L"SOFTWARE
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
Fonts"
;
HKEY
key
;
auto
ret
=
RegOpenKeyExW
(
hkey
,
fonts_key_name
,
0
,
KEY_QUERY_VALUE
,
&
key
);
if
(
ret
!=
ERROR_SUCCESS
)
return
;
BOOST_SCOPE_EXIT_ALL
(
=
)
{
RegCloseKey
(
key
);
};
DWORD
name_buf_size
=
SHRT_MAX
;
DWORD
data_buf_size
=
MAX_PATH
;
auto
font_name
=
new
wchar_t
[
name_buf_size
];
auto
font_filename
=
new
wchar_t
[
data_buf_size
];
for
(
DWORD
i
=
0
;;
++
i
)
{
retry:
DWORD
name_len
=
name_buf_size
;
DWORD
data_len
=
data_buf_size
;
ret
=
RegEnumValueW
(
key
,
i
,
font_name
,
&
name_len
,
NULL
,
NULL
,
reinterpret_cast
<
BYTE
*>
(
font_filename
),
&
data_len
);
if
(
ret
==
ERROR_MORE_DATA
)
{
data_buf_size
=
data_len
;
delete
font_filename
;
font_filename
=
new
wchar_t
[
data_buf_size
];
goto
retry
;
}
if
(
ret
==
ERROR_NO_MORE_ITEMS
)
break
;
if
(
ret
!=
ERROR_SUCCESS
)
continue
;
agi
::
fs
::
path
font_path
(
font_filename
);
if
(
!
agi
::
fs
::
FileExists
(
font_path
))
// Doesn't make a ton of sense to do this with user fonts, but they seem to be stored as full paths anyway
font_path
=
font_dir
/
font_path
;
if
(
agi
::
fs
::
FileExists
(
font_path
))
// The path might simply be invalid
files
.
push_back
(
font_path
);
}
delete
font_name
;
delete
font_filename
;
}
namespace
{
namespace
{
uint32_t
murmur3
(
const
char
*
data
,
uint32_t
len
)
{
uint32_t
murmur3
(
const
char
*
data
,
uint32_t
len
)
{
static
const
uint32_t
c1
=
0xcc9e2d51
;
static
const
uint32_t
c1
=
0xcc9e2d51
;
...
@@ -62,33 +103,17 @@ uint32_t murmur3(const char *data, uint32_t len) {
...
@@ -62,33 +103,17 @@ uint32_t murmur3(const char *data, uint32_t len) {
}
}
std
::
vector
<
agi
::
fs
::
path
>
get_installed_fonts
()
{
std
::
vector
<
agi
::
fs
::
path
>
get_installed_fonts
()
{
static
const
auto
fonts_key_name
=
L"SOFTWARE
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
Fonts"
;
std
::
vector
<
agi
::
fs
::
path
>
files
;
std
::
vector
<
agi
::
fs
::
path
>
files
;
HKEY
key
;
auto
ret
=
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
fonts_key_name
,
0
,
KEY_QUERY_VALUE
,
&
key
);
if
(
ret
!=
ERROR_SUCCESS
)
return
files
;
BOOST_SCOPE_EXIT_ALL
(
=
)
{
RegCloseKey
(
key
);
};
wchar_t
fdir
[
MAX_PATH
];
wchar_t
fdir
[
MAX_PATH
];
SHGetFolderPathW
(
NULL
,
CSIDL_FONTS
,
NULL
,
0
,
fdir
);
SHGetFolderPathW
(
NULL
,
CSIDL_FONTS
,
NULL
,
0
,
fdir
);
agi
::
fs
::
path
font_dir
(
fdir
);
agi
::
fs
::
path
font_dir
(
fdir
);
for
(
DWORD
i
=
0
;;
++
i
)
{
// System fonts
wchar_t
font_name
[
SHRT_MAX
],
font_filename
[
MAX_PATH
];
read_fonts_from_key
(
HKEY_LOCAL_MACHINE
,
font_dir
,
files
);
DWORD
name_len
=
sizeof
(
font_name
);
DWORD
data_len
=
sizeof
(
font_filename
);
ret
=
RegEnumValueW
(
key
,
i
,
font_name
,
&
name_len
,
NULL
,
NULL
,
reinterpret_cast
<
BYTE
*>
(
font_filename
),
&
data_len
);
if
(
ret
==
ERROR_NO_MORE_ITEMS
)
break
;
if
(
ret
!=
ERROR_SUCCESS
)
continue
;
agi
::
fs
::
path
font_path
(
font_filename
);
// User fonts
if
(
!
agi
::
fs
::
FileExists
(
font_path
))
read_fonts_from_key
(
HKEY_CURRENT_USER
,
font_dir
,
files
);
font_path
=
font_dir
/
font_path
;
files
.
push_back
(
font_path
);
}
return
files
;
return
files
;
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter