Czcionki spoza systemu
Aktualny czas: 29-04-26, 00:07 Witaj! Przejdź do zakładki Logowanie lub Rejestracja


Wątek zamknięty 
[XP] Czcionki spoza systemu
Ayene Offline
*


Liczba postów: 758
Dołączył: 09-04-13

Pomógł: 112



Post: #10
RE: Czcionki spoza systemu

Hmm... a sprawdź ten skrypt. Korzystam z niego w Wymiarze X i chyba nie ma tego błędu...
#==============================================================================
# ** Fonts
#------------------------------------------------------------------------------
#  Install or load the font.
#==============================================================================

module Fonts
  AutoInstall = {'Arial.ttf' => 'Arial'}
  Source = 'Fonts/'  
  AFR = Win32API.new('gdi32', 'AddFontResource', ['P'], 'L')
  WPS = Win32API.new('kernel32', 'WriteProfileString', ['P'] * 3, 'L')
  SM = Win32API.new('user32', 'SendNotifyMessage', ['L'] * 4, 'L')
  SHGetFolderPath = Win32API.new("shell32.dll","SHGetFolderPath","PIPIP","I")
  WM_FONTCHANGE = 0x001D
  HWND_BROADCAST = 0xffff
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def self.reload_custom_fonts
    needs_reset = false
    for i in Fonts::AutoInstall.keys
      f = i.dup
      n = Fonts::AutoInstall[f]
      if not Font.exist?(n)
        if FileTest.exists?(Fonts::Source + f)
          needs_reset = true
          fontDir = " " * 256
          SHGetFolderPath.call(0,0x0014,0,0,fontDir)
          fontDir = fontDir.strip.gsub("\000","")
          fontDir.gsub!(/\\/, "/")
          if File.writable_real?(fontDir)
            dest = File.open("#{fontDir}/#{f}", "w+")
            src = File.open(Fonts::Source + f, "r")
            src.each { |line| dest.puts(line) }
            dest.close; src.close
            AFR.call("#{fontDir}/#{f}")
            SM.call(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
            WPS.call('Fonts', '#{f} (TrueType)', f)
          else
            Fonts::Source + f
            AFR.call(Fonts::Source + f)
            SM.call(HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
            WPS.call('Fonts', n + ' (TrueType)', f)
          end
        else
          p 'Czcionki: font ' + f + ' nie znaleziono.'
        end
      end
    end
    if needs_reset
      Thread.new { system('Game') }
      exit
    end
  end
end
Fonts.reload_custom_fonts

[Obrazek: aye_furniture_pres.png]
08-11-14 14:41
Znajdź wszystkie posty użytkownika
"Pomógł" przyznał(a):
Wątek zamknięty 


Wiadomości w tym wątku
RE: Czcionki spoza systemu - Ayene - 08-11-14 14:41
RE: Czcionki spoza systemu - Ayene - 13-12-14, 12:19

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości

Kontakt | Ultima Forum | Wróć do góry | Wróć do forów | Wersja bez grafiki | RSS
Powered By MyBB. © 2013 MyBB Group. All Rights Reserved.
Skórka by Ayene.