/// <summary> /// 传入用户的字体的accesskey和需要处理的文本,然后进行构建字体库 /// </summary> /// <param name="apikey">用户的apikey</param> /// <param name="accessKey">字体的accesskey</param> /// <param name="content">需要处理的文本</param> /// <returns></returns> private async Task <WebFontInfo> BuildFont(string apikey, string accessKey, string content) { FontBuildAccessKeyRequest request = new FontBuildAccessKeyRequest { Apikey = _apiKey, Accesskey = accessKey, Text = content, NeedTtf = true, //如果不需要此格式的文件返回,则此处参数设置为false NeedEot = false, //如果不需要此格式的文件返回,则此处参数设置为false NeedWoff = false, //如果不需要此格式的文件返回,则此处参数设置为false NeedWoff2 = false //如果不需要此格式的文件返回,则此处参数设置为false }; try { var response = await _client.BuildFontForAccessKeyAsync(request); WebFontInfo webFontInfo = new WebFontInfo() { apiKey = apikey, fontId = (int)response.FontId, content = content, fontCheckSum = (long)response.FontChecksum, fontFormatVersion = (int)response.FontFormatVersion, nameEn = response.NameEn, bytesTtf = response.BytesTtf.ToByteArray(), bytesEot = response.BytesEot.ToByteArray(), bytesWoff = response.BytesWoff.ToByteArray(), bytesWoff2 = response.BytesWoff2.ToByteArray() }; //---------------------------打印日志-------------------------- return(webFontInfo); } catch (Exception e) { _logger.Log(LogLevel.Warning, "RPC failed: {0} Desc: {1}", new Object[] { e.Message, e.StackTrace }); throw e; } }