2013-07-14 1 views
1

사용자 정의 글꼴과 관련된 문제가 있습니다. 다음 이미지는 내가 말하는 것을 더 잘 보여줍니다.사용자 정의 글꼴 잘라 내기

enter image description here

다음은 내가 현재 사용되는 코드입니다.

@Override 
    public void onLoadResources() { 
      BitmapTextureAtlas mComixLoudFontTexture = new BitmapTextureAtlas(256, 
          256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); 
      mComixLoudFont = FontFactory.createFromAsset(mComixLoudFontTexture, 
          this, "Comix_Loud.ttf", 40, true, Color.BLACK); 

      BitmapTextureAtlas mLCDFontTexture = new BitmapTextureAtlas(256, 256, 
          TextureOptions.BILINEAR_PREMULTIPLYALPHA); 
      mLCDFont = FontFactory.createFromAsset(mLCDFontTexture, this, 
          "LCD.ttf", 40, true, Color.BLACK); 

      this.mEngine.getTextureManager().loadTextures(mComixLoudFontTexture, 
          mLCDFontTexture); 
      this.mEngine.getFontManager().loadFonts(mComixLoudFont, mLCDFont); 
    } 

    @Override 
    public Scene onLoadScene() { 
      mScene = new Scene(); 
      mScene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f)); 
      mScene.attachChild(new Text(230, 100, mComixLoudFont, "Comix Loud Font")); 
      mScene.attachChild(new Text(230, 200, mLCDFont, "LCD Font")); 
      return mScene; 
    } 

일부 글꼴 유형에서는 문제가 발생하고 일부는 완벽하게 작동합니다. 이런 상황에서 무엇을해야할까요? 나는 이미 커다란 텍스쳐 아틀라스 사이즈를 설정했지만, 그것은 나에게 도움이되지 못했다.

감사합니다.

답변

0

이 문제를 해결하는 데 사용할 수있는 두 가지 방법이 있습니다.

1) Bitmap Font Generator 또는 Glyf Designer과 같은 유틸리티를 사용하여 수동으로 비트 맵 글꼴 텍스처를 만든 다음 BitmapFont 클래스를 사용하여로드 할 수 있습니다. 이것이 최선의 선택이라고 생각합니다.

2) 텍스트 비트 맵의 ​​패딩 변수를 늘려 맨 위를 잘라 내지 않아야합니다. 이게 효과가 있을지 모르겠다. 그러나 이론적으로 그것은 모든 글자 주위의 영역을 확장시키고 글자를 각 단어에 간격을 두어 놓을 것입니다. 최선의 선택이 아닙니다.

+0

감사합니다. 나는이 두 가지를 확인하고 어떤 것이 나를 위해 일하는지 회신 할 것입니다. – Siddharth

+0

두 번째 제안을 적용하고 다음 게시물에 세부 정보를 게시합니다. http://www.andengine.org/forums/gles1/custom-font-cut-off-t12562.html – Siddharth