Skip to content

Commit

Permalink
Last Commit.(No more update)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaehee0507 committed Mar 7, 2020
1 parent 97c05c6 commit 981c8bb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
6 changes: 3 additions & 3 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
Expand Down
20 changes: 12 additions & 8 deletions app/src/main/java/ifteam/affogatoman/fontgen/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.obsez.android.lib.filechooser.ChooserDialog
import kotlinx.android.synthetic.main.main.*
import kotlinx.android.synthetic.main.setting.*
import java.io.*
import kotlin.math.pow
Expand Down Expand Up @@ -141,8 +142,8 @@ class MainActivity : AppCompatActivity() {

override fun run() {
try {
var startX = drawPaddingX
var startY = drawPaddingY
var startX = 0
var startY = 0

if (!isOnlyKorean) {
glyph = 0x00
Expand All @@ -158,7 +159,7 @@ class MainActivity : AppCompatActivity() {
paint.textSize = fontSize_.toFloat()
paint.isAntiAlias = isAntiAlias

val piece: Bitmap = Bitmap.createBitmap(bitmapSize / 16, bitmapSize, Bitmap.Config.ARGB_8888)
val piece: Bitmap = Bitmap.createBitmap(bitmapSize / 16, bitmapSize / 16, Bitmap.Config.ARGB_8888)
val pieceCanvas = Canvas(piece)
val rect = Rect()

Expand All @@ -170,7 +171,7 @@ class MainActivity : AppCompatActivity() {
//Thread.sleep(1)
paint.getTextBounds(i.toChar().toString(), 0, 1, rect)
Log.i(TAG, rect.left.toString())
pieceCanvas.drawText(i.toChar().toString(), ((bitmapSize / 16) - rect.width()) / 2 - rect.left.toFloat(), bitmapSize * 13.7f / 256, paint)
pieceCanvas.drawText(i.toChar().toString(), (((bitmapSize / 16) - rect.width()) / 2 - rect.left.toFloat()) + drawPaddingX, (bitmapSize * 13.7f / 256) + drawPaddingY, paint)
canvas.drawBitmap(piece, startX.toFloat(), startY.toFloat(), null)
piece.eraseColor(Color.TRANSPARENT)
startX += bitmapSize / 16
Expand All @@ -184,10 +185,10 @@ class MainActivity : AppCompatActivity() {
file.createNewFile()
}
if ((i - startChar) % 16 == 15 && i != startChar) {
startX = drawPaddingX
startX = 0
startY += bitmapSize / 16
}
if (startY - drawPaddingY >= bitmapSize || i == maxCount) {
if (startY >= bitmapSize || i == maxCount) {
file = File("${Environment.getExternalStorageDirectory().absolutePath}/FontGen/$current/font/glyph_" + "%02X".format(glyph) + ".png")
file.parentFile.mkdirs()
val fileOutputStream: OutputStream = FileOutputStream(file)
Expand All @@ -198,7 +199,7 @@ class MainActivity : AppCompatActivity() {
if (i != maxCount) {
baseBitmap.eraseColor(Color.TRANSPARENT)
}
startY = drawPaddingY
startY = 0
glyph++
}
i++
Expand Down Expand Up @@ -228,12 +229,13 @@ class MainActivity : AppCompatActivity() {

if (runnable?.stopKey == true)
makeButton.text = i.toChar().toString()
if ((i - startChar) % 64 == 63 && runnable?.stopKey == true && isFontImageLive == true)
if ((i - startChar) % 64 == 63 && runnable?.stopKey == true && isFontImageLive)
screenImageView!!.setImageBitmap(baseBitmap)
characterProgressBar!!.max = maxCount - startChar
characterProgressBar!!.progress = i - startChar
if (i == maxCount) {
bitmapSizeSeekBar.isEnabled = true
findButton.isEnabled = true
makeButton.text = getString(R.string.make)
makeButton.isEnabled = true
settingButton.text = getString(R.string.setting)
Expand Down Expand Up @@ -284,6 +286,7 @@ class MainActivity : AppCompatActivity() {
R.id.make -> {
makeFont(fontSize)
settingButton.text = getString(R.string.cancel)
findButton.isEnabled = false
makeButton.isEnabled = false
bitmapSizeSeekBar.isEnabled = false
}
Expand Down Expand Up @@ -367,6 +370,7 @@ class MainActivity : AppCompatActivity() {
private fun cancelMakeFont() {
runnable?.stop()
screenImageView?.setImageResource(R.drawable.main)
findButton.isEnabled = true
bitmapSizeSeekBar.isEnabled = true
makeButton.isEnabled = true
makeButton.text = getString(R.string.make)
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/res/layout/license.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:textSize="24dp" android:gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/license" />

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/license"
android:textSize="18sp" />
</LinearLayout>
3 changes: 1 addition & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
<string name="info" translatable="false">정보</string>
<string name="setting" translatable="false">설정</string>
<string name="make" translatable="false">생성</string>
<string name="license" translatable="false">Copyright 2020. JJH조재희 all rights reserved.</string>
<string name="license" translatable="false">FontGen\n \nhttps://github.com/organization/FontGen\n \nCopyright 2020 JJH조재희 all rights reserved.</string>
<string name="cancel" translatable="false">취소</string>
<string name="confirm" translatable="false">확인</string>
<string name="setting_title" translatable="false">스타일 설정하기</string>
<string name="set_ttf_file" translatable="false">폰트 파일을 설정해주세요.\n(없을 경우 시스템 폰트로 설정됩니다.)</string>
<string name="choose_ttf_file" translatable="false">폰트 파일 선택하기</string>
<string name="path_ttf_file" translatable="false">폰트 경로</string>
<string name="find_ttf_file" translatable="false">찾기</string>
Expand Down

0 comments on commit 981c8bb

Please sign in to comment.