Procházet zdrojové kódy

Fetching some "default" font filename

With empty pattern, default config etc...
Yann Weber před 5 roky
rodič
revize
06aa4f68af
2 změnil soubory, kde provedl 26 přidání a 19 odebrání
  1. 4
    0
      sdl.asm
  2. 22
    19
      yaglitch.asm

+ 4
- 0
sdl.asm Zobrazit soubor

@@ -103,4 +103,8 @@ Extern FcObjectSetBuild
103 103
 Extern FcFontList
104 104
 Extern FcPatternGetString
105 105
 Extern FcPatternPrint
106
+Extern FcPatternAdd
107
+Extern FcFontMatch
106 108
 
109
+%define FcTypeInteger 1
110
+%define FC_MONO 100

+ 22
- 19
yaglitch.asm Zobrazit soubor

@@ -72,10 +72,9 @@ section .data
72 72
 	def_str badop_error, {"Bad OP", 0xA}
73 73
 
74 74
 	window_title: db "Yaglitch", 0x0
75
-	font_name: db "Sans.ttf", 0x0
76 75
 	FC_FILE: db "file", 0x0
77
-	FC_FAMILY: db "family", 0x0
78
-	FC_LANG: db "lang", 0x0
76
+	;FC_SPACING: db "spacing", 0x0
77
+	;FC_LANG: db "lang", 0x0
79 78
 
80 79
 section .bss
81 80
 
@@ -132,6 +131,7 @@ section .bss
132 131
 	fc_object_set: resq 1
133 132
 	fc_font_set: resq 1
134 133
 	fc_font_file_ptr: resq 1
134
+	fc_result: resd 1
135 135
 
136 136
 section .text
137 137
 global _start
@@ -477,32 +477,35 @@ sdl_init:
477 477
 
478 478
 	; RAZ surface & blit
479 479
 	;call clear_screen ;useless
480
+
481
+
480 482
 	; init fontconfig
481 483
 	call FcInitLoadConfigAndFonts
482 484
 	mov [fc_config], rax
483 485
 	call FcPatternCreate
484 486
 	mov [fc_pattern], rax
485 487
 
486
-	mov rdi, FC_FILE
487
-	;mov rsi, FC_FAMILY
488
-	;mov rdx, FC_LANG
489
-	xor rcx, rcx
490
-	xor r8, r8
491
-	call FcObjectSetBuild
492
-
493
-	mov [fc_object_set], rax
488
+	;; fecthing EN monospace ??
489
+	;mov rdi, [fc_pattern]
490
+	;mov rsi, FC_SPACING
491
+	;mov rdx, FcTypeInteger ; type
492
+	;mov rcx, FC_MONO ; value
493
+	;mov rcx, 1
494
+	;call FcPatternAdd
495
+	;; not calling configsubstitute because no idea of the good "kind"
496
+	;; argument value... FcMatchfont ? FcMatchPattern ? FcMatchScan ? -_-
497
+
498
+	; fetching the "default" font if no pattern nor configsubstitute ??
494 499
 	mov rdi, [fc_config]
495 500
 	mov rsi, [fc_pattern]
496
-	mov rdx, [fc_object_set]
497
-	call FcFontList
498
-	mov [fc_font_set], rax
501
+	mov rdx, fc_result
502
+	call FcFontMatch
503
+	mov rdi, rax
504
+
499 505
 
500
-	mov rdi, [rax+8]
501
-	mov rdi, [rdi] ; 1st font in set
502
-	;mov rdi, [rdi+8] ; 2nd font in set
503 506
 	push rdi ; debug
504 507
 	call FcPatternPrint
505
-	pop rdi
508
+	pop rdi ; end debug
506 509
 	mov rsi, FC_FILE
507 510
 	xor rdx, rdx
508 511
 	mov rcx, fc_font_file_ptr
@@ -540,7 +543,7 @@ loop_event:
540 543
 	xor rdi, rdi
541 544
 	mov [event], rdi
542 545
 	mov rdi, event
543
-	call SDL_WaitEvent
546
+	call SDL_WaitEvent ; TODO : use poll to avoid IPC pipe blocking will waiting...
544 547
 	cmp rax, 0
545 548
 	je sdl_error ; error fetching event...
546 549
 	xor rdi, rdi

Loading…
Zrušit
Uložit