Seite 2 von 4

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 19:28
von Velindos
Hallo STARGÅTE!
Etwas schwierig bei 49.965 Zeilen! Also Versuche ich so!

Mit diesen Fonts läuft er wenn alle anderen FONTS ausschalte!

Code: Alles auswählen

Global Font_ID_01 = LoadFont(#Font_ID_01, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
Global Font_ID_02 = LoadFont(#Font_ID_02, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
Global Font_ID_03 = LoadFont(#Font_ID_03, "Arial",10,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
Global Font_ID_09 = LoadFont(#Font_ID_09, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
Global Font_ID_04 = LoadFont(#Font_ID_04, "Arial Rounded MT Bold", 24,#PB_Font_Bold|#PB_Font_HighQuality)
Global Font_ID_08 = LoadFont(#Font_ID_08, "Arial Rounded MT Bold", 16,#PB_Font_Bold|#PB_Font_HighQuality)
Global Font_ID_05 = LoadFont(#Font_ID_05, "Copperplate Gothic Bold",24,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
Global Font_ID_06 = LoadFont(#Font_ID_06, "Copperplate Gothic Bold",18,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
Global Font_ID_07 = LoadFont(#Font_ID_07, "Cambria", 36, #PB_Font_Bold|#PB_Font_Italic| #PB_Font_HighQuality)
Wenn ich unter PB 5.62-x64 die Font so festlege wie:
Global Font_ID_01 = LoadFont(#PB_Any, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
und so Aufrufe
DrawingFont(FontID(Font_ID_01))
Funzt die Sache nicht mehr, obwohl in der Hilfe von FontID() beschrieben!
Wenn ich die Font wie folgt Festlege

Code: Alles auswählen

#Font_ID_11
Global Font_ID_11 = FontID(LoadFont(#Font_ID_11, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
und so Aufrufe
DrawingFont(FontID(#Font_ID_11))
dann gehen die angeführten Fonts, aber einen neuen Font kann ich nicht mehr anlegen, es kommt die Meldung "Font ist nicht initalisiert", nicht zu vergessen das die Sache im x86 läuft!

Gruss ... Velindos!

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 20:43
von HeX0R
Dein Code sieht nicht zufällig in Wahrheit so aus (man beachte das .l):

Code: Alles auswählen

Global Font_ID_01.l = LoadFont(#PB_Any, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
Ansonsten... lauffähigen Code bitte, der das Problem aufzeigt.

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 20:59
von DrShrek
Hier hast du den Fehler gemacht:

Falsch:

Code: Alles auswählen

#Font_ID_11
Global Font_ID_11 = FontID(LoadFont(#Font_ID_11, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
DrawingFont(FontID(#Font_ID_11))
Richtig:

Code: Alles auswählen

Global Font_ID_11 = FontID(LoadFont(#PB_Any, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
DrawingFont(FontID(Font_ID_11))

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 21:24
von mk-soft
Mal getestet unter Window 7 Pro X64

PB v5.62 x86/x64

Bei mir geht es...

Code: Alles auswählen

EnableExplicit

Enumeration font 1
  #Font_ID_01
  #Font_ID_02
  #Font_ID_03
  #Font_ID_04
  #Font_ID_05
  #Font_ID_06
  #Font_ID_07
  #Font_ID_08
  #Font_ID_09
EndEnumeration

Global Dim FontNo(10) ; Handle in Array FontNo
FontNo(01) = LoadFont(#Font_ID_01, "Forte", 40,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontNo(02) = LoadFont(#Font_ID_02, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontNo(03) = LoadFont(#Font_ID_03, "Arial",10,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontNo(09) = LoadFont(#Font_ID_09, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontNo(04) = LoadFont(#Font_ID_04, "Arial Rounded MT Bold", 24,#PB_Font_Bold|#PB_Font_HighQuality)
FontNo(08) = LoadFont(#Font_ID_08, "Arial Rounded MT Bold", 16,#PB_Font_Bold|#PB_Font_HighQuality)
FontNo(05) = LoadFont(#Font_ID_05, "Copperplate Gothic Bold",24,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
FontNo(06) = LoadFont(#Font_ID_06, "Copperplate Gothic Bold",18,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
FontNo(07) = LoadFont(#Font_ID_07, "Cambria", 36, #PB_Font_Bold|#PB_Font_Italic| #PB_Font_HighQuality)

Global Dim FontPB(10) ; PB Font Objektnummer in Array FontPB
FontPB(01) = LoadFont(#PB_Any, "Forte", 40,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontPB(02) = LoadFont(#PB_Any, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontPB(03) = LoadFont(#PB_Any, "Arial",10,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontPB(09) = LoadFont(#PB_Any, "Arial", 36,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality)
FontPB(04) = LoadFont(#PB_Any, "Arial Rounded MT Bold", 24,#PB_Font_Bold|#PB_Font_HighQuality)
FontPB(08) = LoadFont(#PB_Any, "Arial Rounded MT Bold", 16,#PB_Font_Bold|#PB_Font_HighQuality)
FontPB(05) = LoadFont(#PB_Any, "Copperplate Gothic Bold",24,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
FontPB(06) = LoadFont(#PB_Any, "Copperplate Gothic Bold",18,#PB_Font_HighQuality|#PB_Font_Bold|#PB_Font_Italic)
FontPB(07) = LoadFont(#PB_Any, "Cambria", 36, #PB_Font_Bold|#PB_Font_Italic| #PB_Font_HighQuality)


#WinDX = 2000
#WinDY = 600


Procedure Draw()
  Protected font, x, y
  If StartDrawing(CanvasOutput(0))
    For font = 1 To 9
      x = 5
      y = (font - 1) * 60 + 5
      DrawingFont(FontID(font))
      DrawText(x, y, "Font Konst " + font)
      x = 410
      y = (font - 1) * 60 + 5
      DrawingFont(FontNo(font))
      DrawText(x, y, "Font ID " + FontNo(font))
      x = 975
      y = (font - 1) * 60 + 5
      DrawingFont(FontID(FontPB(font)))
      DrawText(x, y, "Font Any " + FontPB(font))
    Next
    StopDrawing()
  EndIf
  
EndProcedure

Procedure Main()
  
  If OpenWindow(0, #PB_Ignore, #PB_Ignore, #WinDX, #WinDY, "Test Font´s", #PB_Window_SystemMenu)
    CanvasGadget(0, 5, 5, WindowWidth(0) - 10, WindowHeight(0) - 10)
    
    Draw()
    
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Break
      EndSelect
    ForEver  
  EndIf
  
EndProcedure : Main()

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 21:31
von mk-soft
DrShrek hat geschrieben:Hier hast du den Fehler gemacht:

Falsch:

Code: Alles auswählen

#Font_ID_11
Global Font_ID_11 = FontID(LoadFont(#Font_ID_11, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
DrawingFont(FontID(#Font_ID_11))
Richtig:

Code: Alles auswählen

Global Font_ID_11 = FontID(LoadFont(#PB_Any, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
DrawingFont(FontID(Font_ID_11))
Wieder falsch

Global Font_ID_11 = FontID(LoadFont(#PB_Any, ...) ist bereits das Handle von Font
Also nur "DrawingFont(Font_ID_11)

"LoadFont(#PB_Any, ...)" liefert ein PB-Objektnummer von Font
"FontID(PB-Objektnummer)" liefert das Handle zum Font
"DrawingFont( ... ) möchte ein Handle auf das Font

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 21:40
von DrShrek
Stimmt, nicht gesehen: FontID(LoadFont(

Aber wer schreibt denn so einen "Scheiß"?
Keine Überprüfung ob es auch ein gültiger font ist usw....

Code: Alles auswählen

 FontID(LoadFont(#Font_ID_11, "Forte", 44,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))

Re: Unerwartetes Beenden etc...!

Verfasst: 30.07.2018 22:10
von STARGÅTE
Velindos hat geschrieben:Hallo STARGÅTE!Etwas schwierig bei 49.965 Zeilen! Also Versuche ich so!
Deswegen schrieb ich ja "(verkürzten) ausführbaren Code".
Bei 50k Zeilen Code kann die Usache des "Unerwartetes Beenden" durchaus an einer völlig andere Stelle liegen, sich dann aber als Wirkung (zufällig) bei den Fonts zeigen. Zum Beispiel könntest du woanders versehentlich eine Speicherzugriffsverletzung haben, die sich aber nur bemerkbar macht, wenn die zB FontID benutzt, oder viele Fonts lädts, weil diese Speicherzugriffsverletzung z.B. genau in diesen Modulen etwas verändert.
Vorallem: "nicht zu vergessen das die Sache im x86 läuft!" deutet darauf hin.

Im Prinzip hat es mk-soft vorbildlich mit seinem (verkürzten) funktionierenden Beispielcode (in dem alle Möglichkeiten getestet werden) demonstriert, und bei Gelegenheit noch mal die Rückgabewerte von FontID und LoadFont erklärt :allright:.

Wenn der Code von mk-soft bei dir funktioniert (unter x86 und x64) wären das die folgenden nächsten Schritte:
  • Schalte den Purifier an, um zu sehen ob du ggf. Speicherzugriffsverletzung hast
  • Prüfe mögliche Definitionen auf Integer/Long, je nach dem was verlangt wird.
  • Wo tritt der Fehler auf: Beim Laden der Fonts, beim Anzeigen, ... du kannst die Ausführung mit Delay() verzögern oder ggf. mit CallDebugger arbeiten

Re: Unerwartetes Beenden etc...!

Verfasst: 03.08.2018 13:40
von Velindos
Hallo STARGÅTE!
Danke für deine Tips! Hab sie mir zu Herzen genommen und meinen Release auf Uni umgebaut! Uni wegen Base64Decoder() und EncodeImage()!

Wenn ich meinen Uni-Release x64 unter PB 5.46 LTS-kompiliere läuft die Sache! Wenn ich unter PB 5.62 kompiliere habe ich die Meldung beim Beenden nach wie vor! Mit der x86-5.62 und x86-5.46 läuft die Sache!

Die Font´s habe ich wie folgt eingesetzt:

Code: Alles auswählen

#Font_ID_RotstiftText
LoadFont(#Font_ID_RotstiftText, "Arial Rounded MT Bold", 22, #PB_Font_Bold|#PB_Font_HighQuality)
DrawingFont(FontID(#Font_ID_RotstiftText))
; =====================================================================
#Font_MiniEditor_S_Artikel_Loop
SetGadgetFont(#MiniEditor_S_Artikel_Loop,LoadFont(#Font_MiniEditor_S_Artikel_Loop,"Calibri", 9,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
Gruss ... Velindos!

Re: Unerwartetes Beenden etc...!

Verfasst: 03.08.2018 14:49
von DrShrek
machs mal so:

Code: Alles auswählen

#Font_ID_RotstiftText = 200
LoadFont(#Font_ID_RotstiftText, "Arial Rounded MT Bold", 22, #PB_Font_Bold|#PB_Font_HighQuality)
DrawingFont(FontID(#Font_ID_RotstiftText))
; =====================================================================
#Font_MiniEditor_S_Artikel_Loop = 300
SetGadgetFont(#Font_MiniEditor_S_Artikel_Loop,LoadFont(#Font_MiniEditor_S_Artikel_Loop,"Calibri", 9,#PB_Font_Bold|#PB_Font_Italic|#PB_Font_HighQuality))
Ich hoffe Du siehst diesmal was da falsch läuft!
und wie gesagt bisschen mehr checks ob der Font geladen ist usw ...macht Sinn!
=> Dann hättest sicher deine Fehler alleine gefunden ;-)

PS: ich wollte schon "Fauler Sack!" schreiben, verdient hättest es!

weil das geht nur bis 9:

Code: Alles auswählen

Enumeration font 1
  #Font_ID_01
  #Font_ID_02
  #Font_ID_03
  #Font_ID_04
  #Font_ID_05
  #Font_ID_06
  #Font_ID_07
  #Font_ID_08
  #Font_ID_09
EndEnumeration

Re: Unerwartetes Beenden etc...!

Verfasst: 03.08.2018 18:12
von mk-soft
Am besten ein Model "Common" erstellen...

Wie z.B ts-soft dieses anwendet!

Code: Alles auswählen

;-TOP

;- Begin Module Common

DeclareModule Common
  
  Enumeration Windows
  EndEnumeration
  
  Enumeration Gadgets
  EndEnumeration
  
  Enumeration Menus
  EndEnumeration
  
  Enumeration MenuItems
  EndEnumeration
  
  Enumeration Toolbars
  EndEnumeration
  
  Enumeration Statusbars
  EndEnumeration
  
  Enumeration Images
  EndEnumeration
  
  Enumeration Fonts
  EndEnumeration
  
EndDeclareModule

Module Common
  
EndModule

;- End Modue Common

; Datei 1
Enumeration Common::Fonts
  #MyFont_A
  #Myfont_B
EndEnumeration

; Datei 2
Enumeration Common::Fonts
  #MyFont_Dialog_A
  #MyFont_Dialog_B
EndEnumeration

Debug #MyFont_A
Debug #Myfont_B
Debug #MyFont_Dialog_A
Debug #MyFont_Dialog_B
Man sollte auch nicht "#MyFont = 1000" beginnen, da sonst die angelegten internen PB-IDs 0 ...999 unnötig der Speicherplatz verschwendet wird...