Bug 123325

Summary: Font changing with DCOP or Schema
Product: [Applications] konsole Reporter: Thomas Eriksson <thomas.eriksson>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to add DCOP calls for settings font

Description Thomas Eriksson 2006-03-09 11:59:49 UTC
Version:            (using KDE KDE 3.4.3)
Installed from:    Ubuntu Packages
OS:                Linux

I'm the author of the Bashish console theme engine, http://bashish.sf.net

I intend to port Bashish to konsole. What I have got working so far (prototyping) is fg/bg and 16-color changing by generating schemas on the fly.

I have not been able to implement font changing since I found no way of changing fonts except interactively, so my wish is for the Konsole devs to add the following attribute under the session-[n] "class" in dcop:

void setFont(QFont font)

and if possible the following to ease scriptability, so one doesn't have to
write a C++ helper :)
void setFontName(String fontname)
void setFontSize(int size)

a third option would be to add the font as a variable in the Schema.

(I'm using an old version of console, but from looking at the changelog, no such feature have appeared)
Comment 1 Kurt Hindenburg 2006-05-06 18:44:27 UTC
Created attachment 15939 [details]
Patch to add DCOP calls for settings font

Too late to make it into KDE 3.5.3.

% dcop konsole-19829 session-1 font
DejaVu Sans Mono,14,-1,5,50,0,0,0,0,0
% dcop konsole-19829 session-1 setFont Cheq,8,-1,5,50,0,0,0,0,0
% dcop konsole-19829 session-1 font 
Cheq,8,-1,5,50,0,0,0,0,0
Comment 2 Kurt Hindenburg 2006-05-06 18:52:05 UTC
SVN commit 538057 by hindenburg:

Add DCOP calls for font.  Can not test on /trunk right now.

CCBUG: 123325


 M  +14 -0     session.cpp  
 M  +2 -0      session.h  
 M  +2 -0      sessioniface.h  


--- trunk/KDE/kdebase/apps/konsole/konsole/session.cpp #538056:538057
@@ -750,6 +750,20 @@
   emit setSessionSchema(this, schema);
 }
 
+QString TESession::font()
+{
+  return te->getVTFont().toString();
+}
+
+void TESession::setFont(const QString &font)
+{
+  QFont tmp;
+  if (tmp.fromString(font))
+    te->setVTFont(tmp);
+  else
+    kdWarning()<<"unknown font: "<<font<<endl;
+}
+
 QString TESession::encoding()
 {
   return em->codec()->name();
--- trunk/KDE/kdebase/apps/konsole/konsole/session.h #538056:538057
@@ -114,6 +114,8 @@
   void setKeytab(const QString &keytab);
   QSize size();
   void setSize(QSize size);
+  void setFont(const QString &font);
+  QString font();
 
 public Q_SLOTS:
 
--- trunk/KDE/kdebase/apps/konsole/konsole/sessioniface.h #538056:538057
@@ -25,6 +25,8 @@
     virtual void setKeytab(const QString &keyboard) =0;
     virtual QSize size() =0;
     virtual void setSize(QSize size) =0;
+    virtual QString font() =0;
+    virtual void setFont(const QString &font) =0;
 };
 
 #endif // SESSIONIFACE_H
Comment 3 Kurt Hindenburg 2006-06-09 18:25:47 UTC
SVN commit 549730 by hindenburg:

Add DCOP calls setFont() and font().

BUG: 123325


 M  +14 -0     session.cpp  
 M  +2 -0      session.h  
 M  +2 -0      sessioniface.h  


--- branches/KDE/3.5/kdebase/konsole/konsole/session.cpp #549729:549730
@@ -764,6 +764,20 @@
   emit setSessionSchema(this, schema);
 }
 
+QString TESession::font()
+{
+  return te->getVTFont().toString();
+}
+
+void TESession::setFont(const QString &font)
+{
+  QFont tmp;
+  if (tmp.fromString(font))
+    te->setVTFont(tmp);
+  else
+    kdWarning()<<"unknown font: "<<font<<endl;
+}
+
 QString TESession::encoding()
 {
   return em->codec()->name();
--- branches/KDE/3.5/kdebase/konsole/konsole/session.h #549729:549730
@@ -113,6 +113,8 @@
   void setKeytab(const QString &keytab);
   QSize size();
   void setSize(QSize size);
+  void setFont(const QString &font);
+  QString font();
 
 public slots:
 
--- branches/KDE/3.5/kdebase/konsole/konsole/sessioniface.h #549729:549730
@@ -24,6 +24,8 @@
     virtual void setKeytab(const QString &keyboard) =0;
     virtual QSize size() =0;
     virtual void setSize(QSize size) =0;
+    virtual QString font() =0;
+    virtual void setFont(const QString &font) =0;
 };
 
 #endif // SESSIONIFACE_H