i got error on setting this up:
java code
public void SetFont(String _fontName) {
Typeface customfont = Typeface.createFromAsset( controls.activity.getAssets(), _fontName);
paint.setTypeface(customfont);
}
on widget
procedure SetFont(_fontName: string);
procedure jCanvas.SetFont(_fontName: string);
begin
//in designing component state: set value here...
if FInitialized then
jCanvas_SetFont(gApp.jni.jEnv, FjObject, _fontName);
end;
on bridge
procedure jCanvas_SetFont(env: PJNIEnv; _jcanvas: JObject; _fontName: string);
procedure jCanvas_SetFont(env: PJNIEnv; _jcanvas: JObject; _fontName: string);
var
jParams: array[0..0] of jValue;
jMethod: jMethodID=nil;
jCls: jClass=nil;
label
_exceptionOcurred;
begin
if (env = nil) or (_jcanvas = nil) then exit;
jCls:= env^.GetObjectClass(env, _jcanvas);
if jCls = nil then goto _exceptionOcurred;
jMethod:= env^.GetMethodID(env, jCls, 'SetFont', '(Ljava/lang/String;)V');
if jMethod = nil then begin env^.DeleteLocalRef(env, jCls); goto _exceptionOcurred; end;
jParams[0].l:= env^.NewStringUTF(env, PChar(_fontName));
env^.CallVoidMethodA(env, _jcanvas, jMethod, @jParams);
env^.DeleteLocalRef(env,jParams[0].l);
env^.DeleteLocalRef(env, jCls);
_exceptionOcurred: jni_ExceptionOccurred(env);
end;
thank you