Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use system font to display text by adding the directory to HOOPS using HPS::World::SetFontDirectory. https://docs.techsoft3d.com/hps/latest/api_ref/cpp/class_h_p_s_1_1_world.html?highlight=setfontdirectory#_CPPv4N3HPS5World16SetFontDirectoryEPKc

\uD83D\uDCD8 Instructions

Sample for ios_sandbox to display Japanese text with system font on iPad

  1. Add font directory

    Code Block
    NSString *fontDir = @"/System/Library/Fonts/AppFonts";
    MobileApp::inst().setFontDirectory(fontDir.UTF8String);
  2. And set font in system font directory

    Code Block
     HPS::TextKit kit;
    kit.SetPosition(HPS::Point(0,0,0))
    .SetText("テキスト文字").SetFont("HiraMinProN-W3");
    textsegment.InsertText(kit);
  3. ( You can use the code below to check font files and fonts in the directory )

    Code Block
    for (NSString *fontFamilyName in [UIFont familyNames]) {
      for (NSString *fontName in [UIFont fontNamesForFamilyName:fontFamilyName]) {
        NSLog(@"Family: %@    Font: %@", fontFamilyName, fontName);
      }
    }
    NSFileManager *fileMgr = [NSFileManager defaultManager];
    NSArray *files = [fileMgr contentsOfDirectoryAtPath:@"/System/Library/Fonts/AppFonts" error:NULL];
    NSLog(@"%@", files);
        
    NSString *fontDir = @"/System/Library/Fonts/AppFonts";
    MobileApp::inst().setFontDirectory(fontDir.UTF8String);
    Image Removed

For Android:System fonts are stored inside the /system/fonts directoryFor more information, check out our forum post.

...