Tem como incluir fonte de letra no aplicativo?
Esta segunda tela está bem mais legível que a primeira.
Trata-se de um fonte não disponível no Windows.
Como poderia ser feito pra não precisar instalar no Windows?
Incluir fonte de letra no aplicativo
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Incluir fonte de letra no aplicativo
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
-
Claudio Soto
- Colaborador

- Mensagens: 566
- Registrado em: 27 Ago 2012 12:31
- Localização: Uruguay
- Contato:
Incluir fonte de letra no aplicativo
En C con:
char * Filename = hb_parc(1);
AddFontResourceEx( Filename, FR_PRIVATE, NULL );
ver: https://msdn.microsoft.com/en-us/librar ... s.85).aspx
char * Filename = hb_parc(1);
AddFontResourceEx( Filename, FR_PRIVATE, NULL );
ver: https://msdn.microsoft.com/en-us/librar ... s.85).aspx
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Incluir fonte de letra no aplicativo
Encontrei outra mais legal: AddFontMemResourceEx()
https://msdn.microsoft.com/pt-br/librar ... s.85).aspx
Todas juntas:
https://msdn.microsoft.com/pt-br/librar ... s.85).aspx
Todas juntas:
Código: Selecionar todos
FUNCTION AddFontResource( cFileName )
RETURN CallDll( "gdi32.dll", "AddFontResourceA", cFileName )
FUNCTION RemoveFontResource( cFileName )
RETURN CallDll( "gdi32.dll", "RemoveFontResourceA", cFileName )
FUNCTION AddFontFromMem( cFontTxt )
RETURN CallDll( "gdi32.dll", "AddFontMemResourceEx", @cFontTxt, Len( cFontTxt ), 0, 1 )
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- Toledo
- Administrador

- Mensagens: 3133
- Registrado em: 22 Jul 2003 18:39
- Localização: Araçatuba - SP
- Contato:
Incluir fonte de letra no aplicativo
Amigos, no Harbour 3.2 ou 3.4 tem a função WAPI_AddFontResourceEx().
Neste tópico tem um exemplo de uso:
https://pctoledo.org/forum/viewtopic.php?p=90769
Abraços,
Neste tópico tem um exemplo de uso:
https://pctoledo.org/forum/viewtopic.php?p=90769
Abraços,
Toledo - Clipper On Line
toledo@pctoledo.com.br
Harbour 3.2/MiniGui/HwGui
Faça uma doação para o fórum, clique neste link: http://www.pctoledo.com.br/doacao
toledo@pctoledo.com.br
Harbour 3.2/MiniGui/HwGui
Faça uma doação para o fórum, clique neste link: http://www.pctoledo.com.br/doacao
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Incluir fonte de letra no aplicativo
Realmente.... mas usei a opção que mencionei, que achei muuuuuito melhor, por embutir os fontes dentro do EXE.
Por enquanto ficou assim:
Agora só remover as funções que criei, que já existiam..... rshbmk2 -find addfont
hbwin.hbc (installed):
wapi_AddFontMemResourceEx()
wapi_AddFontResource()
wapi_AddFontResourceEx()
addons\sefazclass\josequintas.hbc (not installed):
addfontfrommem()
Por enquanto ficou assim:
Código: Selecionar todos
// FUNCTION AddFontResource( cFileName ); RETURN CallDll( "gdi32.dll", "AddFontResourceA", cFileName )
// FUNCTION RemoveFontResource( cFileName ); RETURN CallDll( "gdi32.dll", "RemoveFontResourceA", cFileName )
FUNCTION AddExtraFonts()
AddFontFromMem( FontOfficeCode() )
AddFontFromMem( FontStop() )
RETURN NIL
FUNCTION AddFontFromMem( cFontTxt )
RETURN CallDll( "gdi32.dll", "AddFontMemResourceEx", @cFontTxt, Len( cFontTxt ), 0, 1 )
FUNCTION FontOfficeCode()
#pragma __binarystreaminclude "..\resource\officecodepro-regular.ttf" | RETURN %s
FUNCTION FontStop()
#pragma __binarystreaminclude "..\resource\stopn.ttf" | RETURN %s
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Incluir fonte de letra no aplicativo
Nem alterou muito o fonte....
Troquei isto: RETURN CallDll( "gdi32.dll", "AddFontMemResourceEx", @cFontTxt, Len( cFontTxt ), 0, 1 )
Por isto: RETURN wapi_AddFontMemResourceEx( @cFontTxt, Len( cFontTxt ), 0, 1 )
Funcionou também.
Troquei isto: RETURN CallDll( "gdi32.dll", "AddFontMemResourceEx", @cFontTxt, Len( cFontTxt ), 0, 1 )
Por isto: RETURN wapi_AddFontMemResourceEx( @cFontTxt, Len( cFontTxt ), 0, 1 )
Funcionou também.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Incluir fonte de letra no aplicativo
Comentário final:
A que usei não tem no Harbour 3.2, só no Harbour 3.4
Mas tá fácil adicionar, como pode ser visto no post anterior.
A que usei não tem no Harbour 3.2, só no Harbour 3.4
Mas tá fácil adicionar, como pode ser visto no post anterior.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/