find_font Function

public function find_font(name) result(path)

The path of font name (a file name or a path), or '' if not found.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: name

a file name or a path

Return Value character(len=:), allocatable


Calls

proc~~find_font~~CallsGraph proc~find_font find_font proc~find_in_dirs find_in_dirs proc~find_font->proc~find_in_dirs

Called by

proc~~find_font~~CalledByGraph proc~find_font find_font proc~get_font get_font proc~get_font->proc~find_font proc~window_gui WindowProxy%window_gui proc~window_gui->proc~find_font proc~label_create label_create proc~label_create->proc~get_font proc~create_hud create_hud proc~create_hud->proc~label_create proc~make_axis make_axis proc~make_axis->proc~label_create proc~make_name_label make_name_label proc~make_name_label->proc~label_create proc~make_name_node make_name_node proc~make_name_node->proc~label_create proc~add_hud_text WindowProxy%add_hud_text proc~add_hud_text->proc~create_hud proc~build_decorations build_decorations proc~build_decorations->proc~make_axis proc~build_decorations->proc~make_name_label proc~create_huds create_huds proc~create_huds->proc~create_hud proc~make_star_node make_star_node proc~make_star_node->proc~make_name_node proc~move_axis move_axis proc~move_axis->proc~make_axis proc~remake_axes remake_axes proc~remake_axes->proc~make_axis proc~set_label_font ReferenceFrame%set_label_font proc~set_label_font->proc~make_name_label proc~set_label_font->proc~remake_axes proc~set_star_names SkySphere%set_star_names proc~set_star_names->proc~make_name_node proc~set_x_label ReferenceFrame%set_x_label proc~set_x_label->proc~make_axis proc~set_y_label ReferenceFrame%set_y_label proc~set_y_label->proc~make_axis proc~set_z_label ReferenceFrame%set_z_label proc~set_z_label->proc~make_axis proc~update_huds update_huds proc~update_huds->proc~create_hud proc~frame WindowProxy%frame proc~frame->proc~create_huds proc~frame->proc~update_huds proc~realize ReferenceFrame%realize proc~frame->proc~realize proc~move_x_axis ReferenceFrame%move_x_axis proc~move_x_axis->proc~move_axis proc~move_y_axis ReferenceFrame%move_y_axis proc~move_y_axis->proc~move_axis proc~move_z_axis ReferenceFrame%move_z_axis proc~move_z_axis->proc~move_axis proc~node~2 SkySphere%node proc~node~2->proc~make_star_node proc~realize->proc~build_decorations proc~realize->proc~realize proc~relayout_labels relayout_labels proc~relayout_labels->proc~remake_axes proc~set_color~2 ReferenceFrame%set_color proc~set_color~2->proc~remake_axes proc~set_star_data SkySphere%set_star_data proc~set_star_data->proc~make_star_node proc~add_child ReferenceFrame%add_child proc~add_child->proc~realize proc~axes_set_color CoordinateAxes%axes_set_color proc~axes_set_color->proc~set_color~2 proc~grid_set_color LatLonGrid%grid_set_color proc~grid_set_color->proc~set_color~2 proc~new_reference_frame new_reference_frame proc~new_reference_frame->proc~set_color~2 proc~place_axes place_axes proc~place_axes->proc~move_x_axis proc~place_axes->proc~move_y_axis proc~place_axes->proc~move_z_axis proc~place_grid_axes place_grid_axes proc~place_grid_axes->proc~move_x_axis proc~place_grid_axes->proc~move_y_axis proc~place_grid_axes->proc~move_z_axis proc~resize WindowProxy%resize proc~resize->proc~frame proc~run WindowProxy%run proc~run->proc~frame proc~segments_set_color CustomLineSegments%segments_set_color proc~segments_set_color->proc~set_color~2 proc~set_label_alignment ReferenceFrame%set_label_alignment proc~set_label_alignment->proc~relayout_labels proc~set_label_size ReferenceFrame%set_label_size proc~set_label_size->proc~relayout_labels proc~set_sky WindowProxy%set_sky proc~set_sky->proc~node~2 proc~sphere_set_color Sphere%sphere_set_color proc~sphere_set_color->proc~set_color~2 proc~time_set_color TimeHandle%time_set_color proc~time_set_color->proc~set_color~2 proc~vector_set_color VectorHandle%vector_set_color proc~vector_set_color->proc~set_color~2 interface~referenceframe ReferenceFrame interface~referenceframe->proc~new_reference_frame proc~grid_set_parameters LatLonGrid%grid_set_parameters proc~grid_set_parameters->proc~place_grid_axes proc~new_coordinate_axes new_coordinate_axes proc~new_coordinate_axes->proc~place_axes proc~new_lat_lon_grid new_lat_lon_grid proc~new_lat_lon_grid->proc~place_grid_axes proc~new_radial_plane new_radial_plane proc~new_radial_plane->proc~place_axes proc~plane_set_parameters RadialPlane%plane_set_parameters proc~plane_set_parameters->proc~place_axes proc~set_axis_length CoordinateAxes%set_axis_length proc~set_axis_length->proc~place_axes interface~coordinateaxes CoordinateAxes interface~coordinateaxes->proc~new_coordinate_axes interface~latlongrid LatLonGrid interface~latlongrid->proc~new_lat_lon_grid interface~radialplane RadialPlane interface~radialplane->proc~new_radial_plane

Source Code

    function find_font(name) result(path)
        character(len=*), intent(in) :: name        !! a file name or a path
        character(len=:), allocatable :: path
        character(len=4096) :: env
        character(len=:), allocatable :: dirs
        character(len=*), parameter :: system_dirs = &
            '/System/Library/Fonts/Supplemental;/System/Library/Fonts;/Library/Fonts;' // &   ! macOS
            '/usr/share/fonts/truetype/dejavu;/usr/share/fonts/TTF;/usr/share/fonts/dejavu;' // &  ! Linux
            '/usr/share/fonts/truetype;/usr/share/fonts;/usr/local/share/fonts;' // &
            'C:/Windows/Fonts'                                                                   ! Windows
        integer :: status
        logical :: exists

        path = ''
        if (len_trim(name) == 0) return
        if (index(name, '/') > 0 .or. index(name, '\') > 0) then
            inquire(file=name, exist=exists)
            if (exists) path = name
            return
        end if
        dirs = ''
        call get_environment_variable('VKFRAMES_FONT_PATH', env, status=status)
        if (status == 0) dirs = trim(env)//';'
        call get_environment_variable('CONDA_PREFIX', env, status=status)
        if (status == 0) dirs = dirs//trim(env)//'/fonts;'//trim(env)//'/Library/fonts;'
        dirs = dirs//system_dirs
        path = find_in_dirs(name, dirs)
    end function find_font