remove use of MAX_PATH_CHARACTERS in text.c
This commit is contained in:
		
							parent
							
								
									cb66bfcde0
								
							
						
					
					
						commit
						eb175c7efa
					
				
							
								
								
									
										23
									
								
								src/text.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								src/text.c
									
									
									
									
									
								
							@ -314,7 +314,7 @@ static int CALLBACK EnumFontFamCallback(CONST LOGFONTA *lpelf, CONST TEXTMETRICA
 | 
				
			|||||||
// Initialisation à faire une fois au début du programme
 | 
					// Initialisation à faire une fois au début du programme
 | 
				
			||||||
void Init_text(void)
 | 
					void Init_text(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  char directory_name[MAX_PATH_CHARACTERS];
 | 
					  char * directory_name;
 | 
				
			||||||
  #ifndef NOTTF
 | 
					  #ifndef NOTTF
 | 
				
			||||||
  // Initialisation de TTF
 | 
					  // Initialisation de TTF
 | 
				
			||||||
  TTF_Init();
 | 
					  TTF_Init();
 | 
				
			||||||
@ -324,21 +324,24 @@ void Init_text(void)
 | 
				
			|||||||
  font_list_start = NULL;
 | 
					  font_list_start = NULL;
 | 
				
			||||||
  Nb_fonts=0;
 | 
					  Nb_fonts=0;
 | 
				
			||||||
  // Parcours du répertoire "fonts"
 | 
					  // Parcours du répertoire "fonts"
 | 
				
			||||||
  snprintf(directory_name, sizeof(directory_name), "%s%s", Data_directory,FONTS_SUBDIRECTORY);
 | 
					  directory_name = Filepath_append_to_dir(Data_directory, FONTS_SUBDIRECTORY);
 | 
				
			||||||
  For_each_file(directory_name, Add_font);
 | 
					  For_each_file(directory_name, Add_font);
 | 
				
			||||||
 | 
					  free(directory_name);
 | 
				
			||||||
  // fonts subdirectory in Config_directory
 | 
					  // fonts subdirectory in Config_directory
 | 
				
			||||||
  snprintf(directory_name, sizeof(directory_name), "%s%s", Config_directory, "/fonts");
 | 
					  directory_name = Filepath_append_to_dir(Config_directory, "fonts");
 | 
				
			||||||
  For_each_file(directory_name, Add_font);
 | 
					  For_each_file(directory_name, Add_font);
 | 
				
			||||||
 | 
					  free(directory_name);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  #if defined(WIN32)
 | 
					  #if defined(WIN32)
 | 
				
			||||||
    // Parcours du répertoire systeme windows "fonts"
 | 
					    // Parcours du répertoire systeme windows "fonts"
 | 
				
			||||||
    #ifndef NOTTF
 | 
					    #ifndef NOTTF
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      char * WindowsPath=getenv("windir");
 | 
					      char * WindowsPath = getenv("windir");
 | 
				
			||||||
      if (WindowsPath)
 | 
					      if (WindowsPath)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        sprintf(directory_name, "%s\\FONTS", WindowsPath);
 | 
					        directory_name = Filepath_append_to_dir(WindowsPath, "FONTS");
 | 
				
			||||||
        For_each_file(directory_name, Add_font);
 | 
					        For_each_file(directory_name, Add_font);
 | 
				
			||||||
 | 
					        free(directory_name);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    #else
 | 
					    #else
 | 
				
			||||||
@ -360,7 +363,7 @@ void Init_text(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      int i,number;
 | 
					      int i,number;
 | 
				
			||||||
      char home_dir[MAXPATHLEN];
 | 
					      char * home_dir = NULL;
 | 
				
			||||||
      const char *font_path_list[3] = {
 | 
					      const char *font_path_list[3] = {
 | 
				
			||||||
         "/System/Library/Fonts",
 | 
					         "/System/Library/Fonts",
 | 
				
			||||||
         "/Library/Fonts"
 | 
					         "/Library/Fonts"
 | 
				
			||||||
@ -371,13 +374,14 @@ void Init_text(void)
 | 
				
			|||||||
      //CFURLGetFileSystemRepresentation(url, true, (UInt8 *) home_dir, MAXPATHLEN);
 | 
					      //CFURLGetFileSystemRepresentation(url, true, (UInt8 *) home_dir, MAXPATHLEN);
 | 
				
			||||||
      if (getenv("HOME") != NULL)
 | 
					      if (getenv("HOME") != NULL)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        snprintf(home_dir, sizeof(home_dir), "%s/Library/Fonts", getenv("HOME"));
 | 
					        home_dir = Filepath_append_to_dir(getenv("HOME"), "Library/Fonts");
 | 
				
			||||||
        font_path_list[number++] = home_dir;
 | 
					        font_path_list[number++] = home_dir;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      for(i=0;i<number;i++)
 | 
					      for(i=0;i<number;i++)
 | 
				
			||||||
         For_each_file(*(font_path_list+i),Add_font);
 | 
					         For_each_file(font_path_list[i],Add_font);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      free(home_dir);
 | 
				
			||||||
      //CFRelease(url);
 | 
					      //CFRelease(url);
 | 
				
			||||||
    #endif
 | 
					    #endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -801,5 +805,4 @@ byte *Render_text(const char *str, int font_number, int size, int antialias, int
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    return Render_text_SFont(str, font_number, width, height, palette);
 | 
					    return Render_text_SFont(str, font_number, width, height, palette);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user