Browse Source

Fetching some "default" font filename

With empty pattern, default config etc...
Yann Weber 5 years ago
parent
commit
06aa4f68af
2 changed files with 26 additions and 19 deletions
  1. 4
    0
      sdl.asm
  2. 22
    19
      yaglitch.asm

+ 4
- 0
sdl.asm View File

103
 Extern FcFontList
103
 Extern FcFontList
104
 Extern FcPatternGetString
104
 Extern FcPatternGetString
105
 Extern FcPatternPrint
105
 Extern FcPatternPrint
106
+Extern FcPatternAdd
107
+Extern FcFontMatch
106
 
108
 
109
+%define FcTypeInteger 1
110
+%define FC_MONO 100

+ 22
- 19
yaglitch.asm View File

72
 	def_str badop_error, {"Bad OP", 0xA}
72
 	def_str badop_error, {"Bad OP", 0xA}
73
 
73
 
74
 	window_title: db "Yaglitch", 0x0
74
 	window_title: db "Yaglitch", 0x0
75
-	font_name: db "Sans.ttf", 0x0
76
 	FC_FILE: db "file", 0x0
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
 section .bss
79
 section .bss
81
 
80
 
132
 	fc_object_set: resq 1
131
 	fc_object_set: resq 1
133
 	fc_font_set: resq 1
132
 	fc_font_set: resq 1
134
 	fc_font_file_ptr: resq 1
133
 	fc_font_file_ptr: resq 1
134
+	fc_result: resd 1
135
 
135
 
136
 section .text
136
 section .text
137
 global _start
137
 global _start
477
 
477
 
478
 	; RAZ surface & blit
478
 	; RAZ surface & blit
479
 	;call clear_screen ;useless
479
 	;call clear_screen ;useless
480
+
481
+
480
 	; init fontconfig
482
 	; init fontconfig
481
 	call FcInitLoadConfigAndFonts
483
 	call FcInitLoadConfigAndFonts
482
 	mov [fc_config], rax
484
 	mov [fc_config], rax
483
 	call FcPatternCreate
485
 	call FcPatternCreate
484
 	mov [fc_pattern], rax
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
 	mov rdi, [fc_config]
499
 	mov rdi, [fc_config]
495
 	mov rsi, [fc_pattern]
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
 	push rdi ; debug
506
 	push rdi ; debug
504
 	call FcPatternPrint
507
 	call FcPatternPrint
505
-	pop rdi
508
+	pop rdi ; end debug
506
 	mov rsi, FC_FILE
509
 	mov rsi, FC_FILE
507
 	xor rdx, rdx
510
 	xor rdx, rdx
508
 	mov rcx, fc_font_file_ptr
511
 	mov rcx, fc_font_file_ptr
540
 	xor rdi, rdi
543
 	xor rdi, rdi
541
 	mov [event], rdi
544
 	mov [event], rdi
542
 	mov rdi, event
545
 	mov rdi, event
543
-	call SDL_WaitEvent
546
+	call SDL_WaitEvent ; TODO : use poll to avoid IPC pipe blocking will waiting...
544
 	cmp rax, 0
547
 	cmp rax, 0
545
 	je sdl_error ; error fetching event...
548
 	je sdl_error ; error fetching event...
546
 	xor rdi, rdi
549
 	xor rdi, rdi

Loading…
Cancel
Save