ComediaMaker
Faça Login e conecte-se!!!

Ainda nao é membro?
Registre-se logo e faça parte
dessa Bagaça!!



Auto Font Install V1.0 Banercm


Participe do fórum, é rápido e fácil

ComediaMaker
Faça Login e conecte-se!!!

Ainda nao é membro?
Registre-se logo e faça parte
dessa Bagaça!!



Auto Font Install V1.0 Banercm
ComediaMaker
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Auto Font Install V1.0

Ir para baixo

Auto Font Install V1.0 Empty Auto Font Install V1.0

Mensagem por Ranger Azul Dom Jun 19, 2011 12:54 pm

Auto Font Install V1.0
Autor: Wachunga


Esse script instala fontes no seu projeto que não tenha no computador do jogador. As fontes são instaladas assim que o jogo se inicia.


Instruções:
Cole em cima do Main


Adicionando as fontes:
Primeiramente você precisa criar uma pasta chamada Fonts dentro da pasta do seu jogo (no mesmo lugar onde fica o arquivo RGSS.dll).

Agora para configurar as fontes a serem instaladas procure por essas duas linhas.



Código:
Filenames = ['Nome da Fonte.ttf']

e

Código:
Names = ['Nome da Fonte']

e subistitua o Nome da Fonte pelo nome do arquivo que esta na pasta Fonts. Para instalar mais de uma é só separar os arquivos com virgula, exemplo:


Código:
Filenames = ['Bonzai.ttf', 'Comic Sans MS.ttf']

Fique atento: o "Filenames" deve ser seguido da extensão ".ttf", o "Names" não


Script:

Código:
#==============================================================================
# ** Auto Font Install
#------------------------------------------------------------------------------
# Wachunga
# Version 1.0
# 2006-01-07
#------------------------------------------------------------------------------
=begin

Automatically installs one or more fonts so the player doesn't have to. It
only does this the first time the game is run and the process is quite
transparent (notification to the player is optional).

Thanks to MagicMagor for the pointer to one of the Win32 functions.

FEATURES
- handles installation of fonts so players don't have to
- supports multiple fonts
- process is quite transparent

SETUP
Create a Fonts folder in the game directory and place all fonts to be
installed within. Then update the Filenames and Names constants below,
adding an element to both arrays for each font.

This just installs the fonts. You'll still have to refer to them as necessary,
e.g. setting a new default as follows (in main):
Font.default_name = [Fonts::Names[0], 'MS PGothic']

Note: if player does not have the rights to install fonts on their machine,
this probably won't work -- but then they wouldn't be able to do it manually
either. :)

#------------------------------------------------------------------------------
=end

module Fonts

# filenames of fonts to be in stalled
Filenames = ['Nome da Fonte.ttf']
# e.g. Filenames = ['carbono_pw.ttf','FUTRFW.TTF']

# names (not filenames) of fonts to be installed
Names = ['Nome da Fonte']
# e.g. Names = ['carbono', 'Futurist Fixed-width']

# whether to notify player (via pop-up message) that fonts were installed
Notify = false

# location of fonts (relative to game folder)
Source = 'Fonts/'

# location of fonts after installation
Dest = ENV['SystemRoot'] 'Fonts'

end

class Scene_Title

AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
SM = Win32API.new('user32', 'SendMessage', ['L'] * 4, 'L')
WM_FONTCHANGE = 0x001D
HWND_BROADCAST = 0xffff

alias wachunga_autofontinstall_st_main main
def main
success = []

for i in 0...Fonts::Filenames.size
f = Fonts::Filenames[i]
# check if already installed...
if not FileTest.exists?(Fonts::Dest f)

# check to ensure font is in specified location...
if FileTest.exists?(Fonts::Source f)
# move file to fonts folder
File.rename(Fonts::Source f, Fonts::Dest f)
# add font resource
AFR.call(Fonts::Dest f)
# add entry to win.ini/registry
WPS.call('Fonts', Fonts::Names[i] ' (TrueType)', f)
SM.call(HWND_BROADCAST,WM_FONTCHANGE,0,0)
if FileTest.exists?(Fonts::Dest f)
success.push(Fonts::Names[i])
else
p 'Instalação de fonte automatica: Erro ao instalar' Fonts::Names[i] '.'
end
else
p 'Instalação de fonte automatica: Fonte ' f ' não econtrada.'
end

end
end

if success != [] # one or more fonts successfully installed
if Fonts::Notify
fonts = ''
success.each do |f|
fonts << f << ', '
end
p 'Instalação de fonte automatica: instalação completa ' fonts[0..-3]
end
# new fonts aren't recognized in RMXP until the program is
# restarted, so this is (unfortunately) necessary
a = Thread.new { system('Game') }
exit
end
wachunga_autofontinstall_st_main
end

end
Ranger Azul
Ranger Azul
Cabo do CM
Cabo do CM

Mensagens : 85
Comédia Grana : 4958
Créditos : 27
Humor : È hora de Morfar

Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos